The European nation took the lead in the seventh minute of the contest through Josko Gvardiol, but Achraf Dari levelled the scores just two minutes later.
Croatia regained the lead just before the half-time interval through Mislav Orsic, though, and the goal proved to be the difference between the two teams in the third-place playoff contest.
Morocco, who have enjoyed their best-ever World Cup, were beaten by France in the semi-finals, while Croatia's quest for the trophy was ended by Argentina in the final four.
Morocco goalkeeper Bono almost passed the ball into the back of his own net in the second minute of the match, and it would certainly have gone down as the strangest goal of the tournament thus far had it landed between the sticks.
Croatia took the lead in the seventh minute, and it was in-demand centre-back Gvardiol who found the back of the net with a wonderful header after the ball was flicked towards him by Ivan Perisic.
Morocco were behind for less than two minutes, though, with Dari nodding home from close range after a free kick had been deflected high into the Croatian penalty box by Luka Modric.
It was an incredibly open match, with Josip Stanisic firing over the Moroccan crossbar in the 14th minute before Andrej Kramaric headed at Bono shortly after.
Bono had to be alive to keep out a strike from Modric in the 24th minute before Perisic headed over the crossbar during a period when Croatia were looking the more likely to find the back of the net for a second time.
Youssef En-Nesyri headed a corner from Hakim Ziyech just wide of the far post 10 minutes before the interval, before the latter struck just wide of the target five minutes later.
Croatia regained the lead just before the break, though, with Orsic finding the back of the net with a wonderful curling finish, with the ball hitting the inside of the post before dropping into the back of the net.
Orsic came close to a second shortly after the restart, with the attacker's effort just whistling wide of the goal.
Nikola Vlasic had the next serious attempt in the 70th minute, with the forward firing wide of the Morocco goal, as the second period headed for its final stages.
Croatia had a strong shout for a penalty in the 74th minute when Gvardiol went down inside the penalty box under a challenge from Sofyan Amrabat, but the referee was not interested.
There was then a VAR check on a possible penalty for Morocco when Achraf Hakimi went down, but the challenge was outside the area.
Mateo Kovacic had the chance to settle the contest in the 87th minute when he broke into the Morocco box, but the Chelsea midfielder fired wide of the post.
Morocco then had a golden chance to level in the sixth minute of added time at the end of the 90 when he climbed highest inside the box to meet a deep cross, but his header was just too high, allowing Croatia to triumph in normal time.