The Portuguese playmaker opened the scoring in the first half and then grabbed the winner seven minutes from time to move Malaga clear of the relegation zone.
Sevilla looked to have turned the match around in the second half as goals from Carlos Bacca and Federico Fazio put them in front, but the game turned for a second time.
Samu made it 2-2 in the 77th minute before Duda had the final say as Sevilla's European hopes took a hit at the hands of their Andalusian rivals.
Jose Antonio Reyes had a chance to put Sevilla in front in the 14th minute, but his shot from inside the area was blocked by Willy Caballero.
Instead Duda put Malaga ahead after half-an-hour, slotting a penalty low into the right corner after he himself had been fouled by Coke.
The visitors made a double change at the break, Coke and Reyes replaced by Diogo Figueiras and Kevin Gameiro and the switch paid immediate dividends.
Bacca levelled in the 49th minute, finishing into the bottom corner from the left of the area, before Fazio put the visitors in front.
Ivan Rakitic swung in a free-kick and the centre-back met it with his head to make it 2-1 in the 66th minute.
There were more twists to come, though, and Samu slammed an equaliser into the top corner following a cross from Pablo Perez
And Duda completed the comeback, and a topsy-turvy half, with the winner in the 83rd minute.
Perez was again the provider, sliding the ball in from the left for his team-mate to finish from close range.