The Stuttgart midfielder rose to nod the ball beyond Fernando Muslera after
Uruguay failed to clear a late corner, while Diego Forlan came inches away from a dramatic equaliser with an injury-time free-kick that struck the crossbar.
Forlan rounded off an impressive individual showing at the tournament with a brilliantly taken volley to give Uruguay a 2-1 lead early in the second period, only for Marcell Jansen to restore parity moments later.
"We came back after going behind – I think that shows the strength of character of this team," said German captain Bastian Schweinsteiger. "We had great fun playing at this World Cup. Of course you think about what happened. But I'll be looking to the future – there are still a lot of things to win."
"We wanted to win, we wanted to do something for all our fans," said match winner Khedira.
"The last game is important because it decides with what kind of feeling you go home," said German coach Joachim Löw. "I think we're going home with pride."
Thomas Müller had put Germany in front in the 19th minute, but Edinson Cavani drew Uruguay level in the 28th minute.
Müller and Forlan's goals took them level with Spain's David Villa and Dutch midfielder Wesley Sneijder in the race for the Golden Boot with five strikes apiece.
The young German will finish as the tournament's official top scorer if Villa and Sneijder both fail to score in Sunday's final, though, because assists are taken into account in case of a tie and he has supplied three to his rivals' one each.
Miroslav Klose's hopes of matching Ronaldo's record of 15 World Cup finals goals were dashed after a back injury saw him relegated to the German bench by Löw alongside skipper Philipp Lahm and goalkeeper Manuel Neuer.
Uruguay looked to take advantage of lethargy in the German ranks in the second period, with Germany goalkeeper Hans-Jörg Butt regularly called into action.
He pulled off a fine double save to repel Cavani and then Luis Suarez, but was then beaten by an acrobatic volley from Forlan that flew inside the right-hand post.
Jansen drew Germany level in the 56th minute when he capitalized on a rash charge from Muslera to nod in Jerome Boateng's right-wing cross.
The livewire Suarez produced a flying save from Butt with an ambitious effort and the veteran also had to dash from his line to deny Forlan.
German substitute Stefan Kiessling smashed a shot straight at Muslera following a bewitching stepover on the edge of the box, before Khedira set the seal on a memorable tournament for Löw's young team.
Kiessling could have made it 4-2 but he swept over from 12 yards after a flowing move.
Germany edged Uruguay 1-0 when the sides met in the third-place match at the 1970 World Cup and they came close to taking an early lead here when Arne Friedrich met Mesut Özil's deep corner with a header that bounced back off the
Uruguay held out for just nine more minutes, with Müller slotting in from close range after 19 minutes after Schweinsteiger's swerving drive was pushed out by Muslera.
Lightning counter-attacks have been Germany's trademark at this tournament but they were dealt a taste of their own medicine in the 28th minute when Diego Perez quickly fed Suarez, whose pass was stabbed home by Cavani.