With Brazil roundly praised for how it has staged the tournament, considered by many fans to be among the most exciting in recent decades, authorities were taking no chances of anything ruining their big day.
Around the Maracana, where 74,000 spectators crammed in for the final, lines of security forces wearing camouflage uniforms and carrying rifles stood watch. Roads were closed and military helicopters buzzed overhead, with Brazilian authorities still wary about violent protests that marred last year's Confederations Cup warm-up event.
Several hundred protesters gathered at a plaza near Maracana a few hours before kickoff, and clashed with police as they neared security perimeters set up roughly 2 kilometers (1.25 miles) from the stadium. Police fired tear gas and stun grenades to disperse the march. At the end of the demonstration, police unleashed the stun grenades gratuitously on a small group of protesters and journalists, and were seen beating some with night sticks. At least one photographer received minor injuries.
For the Brazilian fans, the football ended in disappointment with a 7-1 rout at the hands of the Germans in the semifinals, but the tournament has been hailed as a great success.
"We did ok, yes?" said a Brazilian walking around the outskirts of the Maracana wearing his team's canary-yellow shirt.
Associated Press writer Alan Clendenning and AP Sports Writers Gerald Imray and Stephen Wade contributed to this report.