Florian Thauvin deservedly put the hosts in front after 36 minutes before substitute Saber Khelifa sealed the win with the last kick of the game.
Khelifa was only introduced in the 88th minute but slotted past Geoffrey Jourden in injury time to ensure Marseille moved four points clear of Nantes in fourth place.
Andre-Pierre Gignac almost put Elie Baup's men ahead early on, but Marseille had to wait until nine minutes before the interval to see its pressure pay dividends as Thauvin poked home his fourth goal of the season.
Victor Montano almost drew Montpellier level just before the hour as he almost got on the end of a whipped cross, and Siaka Tiene had a free kick saved by Steve Mandanda soon after.
However, Tunisia international Khelifa had the final say when he scored late on to condemn Montpellier to its sixth Ligue 1 game without a win.
Follow GOAL.COM on Twitter
- Sports & Recreation
- Saber Khelifa
- Florian Thauvin