The victory was inspired by a strong second-half performance, at one point giving themselves a five-goal advantage, with Daniel Narcisse and Luc Abalo scoring four goals each.
Croatia were the only team with a 100 per cent record in the competition coming into the game, but their hopes of becoming the first team to win three gold medals in the men's competition are over and they will now contest the bronze medal with Hungary in a prelude to Sunday's final.
France were in the ascendancy from the start and raced into a 3-0 lead after five minutes, but their real hero was at the other end as goalkeeper Thierry Omeyer saved eight out of the first nine shots thrown at him, which allowed that advantage to stretch to 5-1.
But any hopes that a partisan French crowd had of their team running away with it were quickly dashed by a superb response from Croatia, which was almost single-handedly inspired by Zlatko Horvat, who threw in five goals as the the deficit was reduced to 10-9.
France enjoyed a strong final three minutes of the first half, though, and went into the half-time interval 12-10 up.
And they carried that form into the opening exchanges of the second period, putting one foot into the final as four straight goals put them 18-13 ahead with 43 minutes on the clock.
Croatia threatened a comeback when they got back to 19-17, but they came up against an in-form Omeyer who continued to make save after save, which allowed France to remain in control.
Claude Onesta's side advanced comfortably to the final hooter, sealing a three-goal winning margin to set up their date with destiny in two days' time.