Ronaldo stars as Real survive scare to win club WC
Real, who won the tournament for the second time in three years and were crowed champions for a fifth time overall.
Two goals from Gaku Shibasaki stunned the European champions as the Japanese hosts took a 2-1 lead early in the second half before a Ronaldo penalty brought Real level on the hour.
The 11-times European champions then survived several more scares and a possible sending-off for captain Sergio Ramos before Ronaldo scored twice more in the first period of extra-time.
Real, who won the tournament for the second time in three years and were crowed champions for a fifth time overall, appeared set for an easy victory when Karim Benzema gave them a ninth-minute lead but Shibasaki changed the story by levelling one minute before halftime.
Kashima were the first Asian team to reach the final although they qualified for the tournament as champions of host nation
Real went ahead when Luka Modric's volley was parried by Hitoshi Sogahata and Benzema tapped in the rebound.
Kashima refused to be overawed, continued playing their neat football and snatched a shock equaliser just before the break.
Shoma Doi's cross found Shibasaki, whose first touch was poor but he was gifted a second attempt when Raphael Varane failed to clear and he smashed the ball into the net.
Shibasaki struck again six minutes after the break when he collected a poor Real clearance, got away from three opponents and fired a low shot past Keylor Navas from 25 metres.
Real were facing their first defeat since they lost to VfL Wolfsburg in April, a run of 36 competitive games, until Lucas Vazquez was bundled over by Shuto Yamamoto and Ronaldo converted the resulting penalty on the hour.
Kashima continued to give as good as they got and had three good chances in the final minutes of normal time.
Fabricio's goalbound drive was tipped over by Navas and the Costa Rican goalkeeper came to the rescue again one minute later by blocking Mu Kanazaki's shot after he got free of the Real defence.
Yasushi Endo could have won it with the last kick but fired wide at the far post while Sergio Ramos was lucky to escape a second yellow card for a push on an opponent.
Ronaldo ended Kashima's dream when he collected Benzema's slide rule pass and fired past Sogahata eight minutes into extra-time, then settled the match six minutes later with an emphatic finish into the roof of the net.