CARDIFF, Wales — Two long balls, two sharp finishes and Brazil's hopes of its first Olympic gold were over.
Japan's 2-0 victory Friday means it will travel to Manchester for a semifinal against France and a chance to add an Olympic medal to the World Cup it won last year in Germany.
It created few chances, but strikers Yuki Ogimi and Shinobu Ohno took them when it mattered, midway through each half.
Brazilian coach Jorge Barcellos was bitter after the defeat, which ensured the country's worst showing in an Olympics many predicted it would win. The team, featuring superstar Marta, must now rebuild for 2016, when Brazil hosts the games.
"To see our team have so many opportunities and not score, and see the other team playing only at the back and scoring two goals, is a tragedy," he said. "The football that Japan presented didn't deserve to win. We will have to work a lot during the next four years before 2016 in Rio de Janeiro. We want to get the title there."
Playing in front of 28,000 in Cardiff, Brazil settled more quickly, its height and power causing problems for the Japanese. The team won five corners in the first 10 minutes, the final one whipped into the box by Marta and only just cleared away thanks to a one-handed punch by keeper Miho Fukumoto.
Brazil's best chance fell to Renata Costa, who fired over the bar from close range after a good cross from the left by Rosana. Japan struggled to keep possession, but when it did, it passed the ball quickly and accurately, and began troubling the Brazilian defense after 20 minutes.
The goal came at 27 minutes after Fabiana fouled Nahomi Kawasumi just inside the Brazilian half.
Homare Sawa, who took the FIFA Player of the Year award from Marta last year, hit the freekick quickly and appeared to take the Brazilian defense by surprise. Ogimi took four touches before sidefooting the ball past a motionless Andreia into the right-bottom corner of the net.
Brazil, unchanged after the break, pressed forward, but Marta was booked at 49 minutes for raising her boot close to the head of Mizuho Sakaguchi. A few minutes later, Sakaguchi was a given a yellow card for knocking down Formiga as she tried to break into the Japanese penalty area. Marta's freekick flew just wide of the right post.
Brazil, which lost to hosts Britain 1-0 in its third group game, came closest to a tying goal at the hour mark: Christiane rose between two defenders in the Japanese box to a get a free header on goal, but her effort went over.
As the South Americans hunted for a goal, they left gaps that Japan exploited for its second at 72 minutes.
Ogimi picked up a ball kicked from defense on the halfway line and beat a Brazilian player before playing a long, looping pass to Ohno, who was in space in front of the penalty area. Ohno appeared at first to have taken one too many touches with the ball, but cut back inside to chip over Andreia, the ball bouncing into the net off the underside of the bar.
Japanese coach Norio Sasaki said he thought his team had a good chance of reaching the final.
"It was our first time playing against Brazil at a major tournament, and the players could have been fearful of them. But we knew their stamina would decline in the second half, so I told the players to get the ball forward quickly, and it worked," he said.
Brazil has finished second in the last two Olympics, losing to the U.S. both times in the gold-medal match. It was fourth at the 1996 Atlanta Games and at the 2000 Sydney Games, meaning its triumphs in women's soccer are limited to South American championships and gold medals at the 2003 and 2007 Pan American Games.
"We had to play our game, but Japan had more efficiency and chances," said striker Christiane. "The problem in our country is that people don't understand women's football. We don't have the long-term projects as they do in Japan."
All 18 members of the Japanese squad were in Germany last year when Japan won the World Cup in a penalty shootout against the United States. It has not won a medal at the Olympics in its last three attempts, but has been getting closer, finishing fourth in Beijing.