Promoted Villarreal had looked set to move to within four points of third-placed Real Madrid thanks to a first-half goal from Bruno Soriano.
However, with three minutes of stoppage time played, Malaga captain Weligton headed home a corner to snatch a 1-1 draw for the visitors.
The result at El Madrigal means Villarreal could now lose fourth place to Athletic Bilbao if the Basque side are able to beat leaders Barcelona on Sunday, while Malaga provisionally move two points clear of the relegation zone.
Malaga finished fourth in 2012 and sixth last season but they have found it tough going this term after a summer of change and they came into the match on the back of successive defeats to Granada and Athletic.
Villarreal, in contrast, have enjoyed a flying start to life back in the top flight and, unsurprisingly, it was the Yellow Submarine who made much of the running in the first half.
Malaga keeper Willy Caballero did well to turn behind Ikechukwu Uche's shot in the 23rd minute and Mateo Musacchio and Uche - with a terrible miss from six yards out - failed to make the most of further chances.
However, Villarreal claimed the lead in the 32nd minute when Ruben Cani cut the ball back to Bruno inside the area and the Spain international sidefooted his shot into the far corner.
The home side sought further goals and Willy saved from Gabriel before the break to keep the gap at one.
Malaga were struggling to create much going forward but almost drew level in the 67th minute when Eliseu Pereira was denied by a fine save from Villarreal keeper Sergio Asenjo, who then did superbly to immediately tip Pedro Morales' shot around the post.
Willy kept Malaga in it with another parry from Tomas Pina in the 88th minute and that proved crucial as deep into stoppage time veteran centre-back Weligton headed home Morales' corner to salvage a point for Bernd Schuster's side.