The 2-1 victory was sweet revenge for the Americans, who lost to the Japanese in a 2011 World Cup final upset, the first time they had beaten the United States in 26 games. The match drew 80,203 fans to London's Wembley Stadium, breaking the record for a women's soccer game at the Olympics.
Midfielder Carli Lloyd scored both goals for the U.S. -- the first being in the eighth minute of the game. She extended the lead in the 54th minute with a 20-yard right-footer just inside the left post after a long run with the ball through the middle of the Japanese defense. It was her fourth goal of the Olympics and the team's 16th.
Goalkeeper Hope Solo was kept consistently busy for the first time this tournament, leaping and diving to make saves. The teams put on a back-and-forth, don't-turn-your-head soccer showcase, proving again that these are the two premier teams in the world.
Japan answered in the 64th minute when Yuki Ogimi tapped a ball in that the United States defense failed to clear. And Mana Iwabuchi nearly had the equalizer in the 83rd - stripping the ball from captain Christie Rampone and swooping in on Solo - only to be thwarted when the goalie flung her entire body to the left to push the shot away.
The U.S. team has won four of the five Olympic titles since women's soccer was introduced at the 1996 Atlanta Games, settling for mere silver at the 2000 Games in Sydney.
Earlier in the day, Canada won the bronze in women's soccer with a 1-0 victory over France. In the second minute of injury time, Canada's Diana Matheson passed inside the penalty area to midfielder Sophie Schmidt, who turned, dribbled and took a shot. The ball deflected off defender Sonia Bompastor and landed at the feet of Matheson, who volleyed in the game-winner past goalkeeper Sarah Bouhaddi.
It is Canada's first Summer Games medal in a traditional team sport since the 1936 Berlin Games, when the men's basketball team won silver.
In another gold medal for the U.S., the women's water polo team beat out Spain 8-5. It's the first time the U.S. won an Olympic gold medal in the sport.
Maggie Steffens led the way with five goals and goalkeeper Betsey Armstrong gave a sterling performance. The Americans overpowered a young Spanish team on both ends of the pool to lead 5-2 by halftime, and they never looked back.
Claressa Shields, the newest American boxing sensation, won the first middleweight gold medal in women's Olympic boxing with a 19-12 victory over Russia's Nadezda Torlopova. The 17-year-old from Flint, Mich., showed off the free-spirited style and brute strength that made her unbeatable at the London Games.
She was the only one of the 12-member American team to win a gold medal in London. All nine men were eliminated in stunning fashion, leaving the winningest team in Olympic history without a medal from its men's team for the first time.
Shields shuffled, danced and slugged her way past her 33-year-old opponent, and even stuck her tongue out at Torlopova after ducking a few punches in the final round.
The high school junior has overcome an extremely difficult childhood. She has admitted to being sexually abused as a child by a family acquaintance. Her father, who was also a boxer, was in prison until she was 9. Her mother's boyfriend recently went to jail for shooting himself in the foot with a shotgun.
The U.S. women's basketball team beat Australia 86-73 Thursday to advance to a fifth straight gold medal game.
The Americans, who had cruised through their first six Olympic games winning by an average of 38 points, were challenged by the Australians and 6-foot-8 Liz Cambage, who scored 19 points in the first half. Trailing at the start of the second half, the U.S. team stepped up its defense and held Cambage scoreless for the rest of the game.
The U.S. has won the last four golds and 40 consecutive Olympic contests dating back to the bronze medal game in 1992. The team will play France for the title on Sunday -- the first time since 1996 that the Americans won't be facing Australia for the gold.
In track and field, Jamaica's Usain Bolt won the 200 meters in 19.32 seconds, making him the only man with two Olympic titles in that event. He added the 200 gold to the 100 gold he won Sunday, duplicating the 100-200 double he produced at the Beijing Games four years ago.
Elsewhere Thursday, Americans went 1-2 in the decathlon (Ashton Eaton and Trey Hardee) and the triple jump (Christian Taylor and Will Claye), raising the U.S. track and field total with three days to go to 24 medals, one higher than the country's total in Beijing.
The Associated Press contributed to this report.