Odion Ighalo and Inigo Lopez netted to drag the promoted club out of the bottom three and up to 14th with 25 points from 21 games, three above the relegation zone.
Malaga, who have only won once in their last eight league outings are eighth with 28 points, four short of the Champions League qualification berths.
Nigerian striker Ighalo, their top scorer last season when they won a second consecutive promotion, powered in a close-range header in the 57th from a Mikel Rico cross.
Malaga levelled after a clever backheel from Sebastian Fernandez released Nacho Monreal into the area, and he crossed low for Salomon Rondon to sweep the ball home in the 68th.
Granada defender Lopez reacted quickest to put away the winner from a loose ball in the 81st, however, and Malaga's chances of a comeback were checked when Argentina defender Martin Demichelis was sent off soon after a reckless challenge.
- Related links