Alvaro Negredo scored the decisive goal in an ill-tempered Andalucian derby which saw both teams reduced to 10 men.
The former Real Madrid star struck the winner with 15 minutes remaining before Miguel Angel was dismissed for the visitors in the 80th minute and substitute Jose Ortiz received an early bath for Almeria six minutes later.
The referee dished out a further five yellow cards in a tempestuous encounter which saw Almeria record their second league win of the season.
The home side came close to opening the scoring in the fifth minute with a Jose Mane free-kick. However, his in-swinging set piece from the left side was easily saved by goalkeeper Francesc Arnau.
Negredo missed a gilt-edged chance to punish Malaga's poor marking when he headed wide of the right post from close range after 15 minutes.
In an opening period punctuated by jiggly fouls and stoppages, Pablo Paulino had the visitors' first chance when he rifled a hopeful shot wide from 20 yards in the 32nd minute.
Miguel Corona's fierce in-swinging corner five minutes after the interval almost caught out keeper Arnau, who was forced to punch away the dangerous set-piece.
Almeria boss Gonzalo Arconada made a crucial double substitution in the 58th minute to turn the game in his side's favour.
Ortiz and Poquet Natalio came on for Corona and Juanma to instant effect.
Natalio powered down the right wing and provided a perfect cross for Negredo who banished the memory of his early miss to head past a helpless Arnau from six yards.
The home side nearly doubled their lead five minutes later, but Julio Alvarez's dangerous corner was well-saved by the impressive Arnau.
In the closing minutes the ill-feeling between the two sides saw the game degenerate into a slugfest.
Angel was dismissed for a poor challenge on the home side's Natalio with 11 minutes remaining but the sides were evened up when substitute Ortiz went through Pereira Eliseu eight minutes later as tempers boiled over.
Despite there being more space on the pitch following the dismissals, Malaga were unable to breach the Almeria defence in the closing stages.
The result means Almeria finish the weekend in a four-way tie for top spot, alongside Valencia, Villarreal and Espanyol.
Winless Malaga remain entrenched in the bottom three with just one point to their name after what has been a disappointing start to the season.