But Hamilton, 22, took third place to extend his lead to 14 points at the top of the drivers' standings with his eighth consecutive podium finish.
The Ferrari pair had too much pace for McLaren, with Raikkonen gaining the lead from his team-mate on lap 47.
Britain's Jenson Button came eighth to claim his first point of the season.
Defending champion Fernando Alonso, who started from 10th place after mechanical problems in qualifying, battled his way to seventh place but still lost ground on his McLaren team-mate in the title race.
Alonso trails Hamilton by 14 points, with Massa a further three points behind.
Hamilton - who opted for a three-stop strategy - started from second on the grid but Raikkonen got off to a lightning start to overhaul the Briton at the first corner.
The Finn called on his superior pace again to get beyond Massa after his second stop on lap 46, overtaking him as he surged out of the pits.
"Finally the start worked for me," said Raikkonen, who chalked up the 11th victory of his career in France, and his first since his opening day win in Australia.
"I tried to push Felipe, I knew I would stop later and I managed to get ahead of him in the end.
"I expected to go through difficult times and people always think you have lost it if you're not winning, so it's nice to win."
Massa, who started on pole, had amassed a three-second lead over Raikkonen just before his second stop but his chances faded when he got held up by the back-markers.
"I lost the race because of the traffic," said Massa. "I lost too much time and speed, and that was the biggest problem for me.
"But the car is great and we are happy to get the first one-two of the season for Ferrari."
Hamilton made a sluggish start and, on an unusual three-stop strategy, never really threatened the Ferraris.
However, the British rookie showed his class when he jinxed past Robert Kubica at the tight Adelaide Hairpin to regain third after his second stop.
It still says alot for Hamilton that this result in Magny-Cours was his worst since he was third on his debut in Melbourne, following four successive runner-up places and back-to-back wins in Canada and the United States.
"I didn't get off to the best start," said Hamilton. "I don't know what happened, but I saw Kimi flying past.
"But I'm still feeling fairly confident, and as long as we continue to have reliability, then I can look forward to my home race."