Montpellier came alive late in the game to edge out Nice and return to the top of Ligue 1.
Souleymane Camara got the goal in the 75th minute after a period of sustained pressure that started around the hour mark following a subdued start.
Montpellier had only a couple of chance in the first half, and after Marco Estrada had blazed over and Geoffrey Dernis shot wide, it was instead Nice who went closest to scoring with Camel Meriem bringing a fine save out of Geoffrey Jourdren with a shot from the edge of the area.
For a team fighting at the top of the table, Montpellier offered little early in the second half, and it was not until the 59th minute that they created a clear chance, with Olivier Giroud heading Henri Bedimo's cross over the top.
Camara then lashed a 30-yard effort narrowly wide of the post before sending in a superb ball for Giroud to volley goalwards, with his powerful shot going narrowly over.
Camara then set up Giroud again moments later but this time he missed the target when all alone at the back post.
Bedimo broke to cross for Giroud who met the ball at the near post with a first-time shot, but David Ospina was alert to make the save.
The breakthrough came with a quarter of an hour to go with Garry Bocaly racing down the right before crossing for Camara to finish from the edge of the area with a left-footed shot.
Nice were unlucky not to level three minutes later than Abraham Guie Guie headed against the crossbar from a corner, and then Nemanja Pejcinovic also struck the bar with a shot on the follow-up.
But instead, Montpellier hung on for the three points.