The 31-year-old, who has won five Champions League titles with Real Madrid, calmly chipped home Spain's sixth kick of the shootout as they claimed their first silverware since the 2012 European Championship.
The final at the Feyenoord Stadium ended goalless after extra time, and defeat on penalties was a further heartbreak for an expectant Croatia, who were runners-up at the 2018 World Cup and third in Qatar last year, but are yet to win a title.
Spain goalkeeper Unai Simon first saved from Lovro Majer in the shootout, giving Aymeric Laporte a chance to win the contest, but the defender blasted his effort against the crossbar to leave it 4-4 after five kicks each.
But Simon came up trumps again with another save, this time from Bruno Petkovic, before Carvajal wrapped up victory.
"It was a very tight match, we knew we weren't going to win easily," said Simon.
Despite their trophy drought, however, Spain manager Luis de la Fuente told fans to expect more from his talented core of young players.
"These players are used to winning," De la Fuente told reporters after the win. "They have won so much coming through the ranks and this can continue, I think this competitive streak is back and we can look forward to winning more."
Spain should have opened the scoring in the 12th minute after stealing possession away from Croatia but Gavi dragged his shot wide.
A long ball from deep in Croatia's half caught out Spain's high defensive line and allowed Andrej Kramaric a breakaway chance in the 23rd minute but Laporte chased back to make a superb tackle.
In the second half, Croatia's Ivan Perisic made headway down the left flank and provided an inviting cross that Mario Pasalic missed and Josip Juranovic followed up with a wild effort well wide of goal.
Spain substitute Ansu Fati added energy to their cause when he came on and he might have won the game in the 84th minute when Rodri set him up to shoot from close range, but Perisic was on the line to clear with goalkeeper Dominik Livakovic beaten.
Spain finished the two-hour contest strongly as Olmo had another chance and Rodri saw his shot deflected narrowly wide.
Croatia coach Vlatko Dalic said the future of his captain Luka Modric remained unclear, after the 37-year-old Real Madrid midfielder put in another impressive showing.
"Luka said he would take his own decision after the tournament, that is fair," Dalic said. "He played great, we would love Luka to stay, he is a great player and I hope he will stay with us for a long time."
- Felix Zwayer