Giroud volleyed in from outside the box on 89 minutes to send Montpellier up to 60 points from 29 games, one ahead of Paris St Germain who host Girondins Bordeaux on Sunday.
Unheralded Montpellier, who have never won the French title and were not expected to mount a challenge this term, created lots of chances but lacked a cutting edge before league top scorer Giroud struck for the 18th time in Ligue 1 this season.
"There is not much to say. A team attacked and the other only defended," coach Rene Girard told Foot+ television.
Nice's Fabian Monzon scored from the penalty spot after 76 minutes to cancel out Andre Ayew's opener in the 56th minute.
They are eighth on 40 points while Nice are 18th on 28 points in the 20 team-table, one from safety.
"We stopped the bleeding. We managed a draw under difficult circumstances," coach Didier Deschamps told a news conference.
"We showed heart, courage and fighting spirit."
Hazard put the champions ahead on 36 minutes after he was fouled in the box. Dimitri Payet doubled their lead in the 55th minute after a Hazard pass and Benoit Pedretti completed the victory 12 minutes later.
Lille occupy the Champions League playoff round berth on 53 points.
Valenciennes' win vaulted the northerners up to 11th.