The 30-year-old's effort was the joint third longest of all time in one of the all-time great shot finals that saw the 32-year-old championship record of Switzerland's Werner Gunther eclipsed by all three medallists.
"It is great to do this in front of my wife," said Kovacs who was also 2015 world champion.
"I just kept telling myself to hang on in there and keep calm. It will come good."
Olympic champion Ryan Crouser, who had set the tone with his first throw breaking Gunther's mark, crept into the silver medal position with a final effort of 22.90m.
New Zealand's defending champion Tomas Walsh had led from the first round but suddenly found himself in bronze medal position and came up short with his fifth no throw of the final.
Although he also threw a best of 22.90m Crowser took silver due to having more legal attempts.