RIO DE JANEIRO (AP) — In another Chinese duel, Ding Ning ended up with Olympic gold.

Ding beat teammate Li Xiaoxia in the women's table tennis final on Wednesday, reversing the result from four years ago.

When the 26-year-old Ding lost to Li in the final at the 2012 London Games, she broke down in tears. In Rio de Janeiro, there were tears again as she dropped to her knees in celebration.

The tense match, which came down to a deciding seventh game, was filled with long rallies, lighting quick smashes, looping topspin forehands and stretching defensive saves — all signs that these two players have spent many, many hours playing together over the years.

After nearly every point, the winner raised her fist, let out a sharp yell and stalked away from the table. Ding, a lefthander, relied on a crouching, tomahawk-style serve. Li often fanned herself with her bat while awaiting serve.

The rivals went back and forth over the first three games, the medal podium standing in shadows next to their spotlighted table.

Ding, the reigning world champion, took the first game. Li bounced back in the second, and Ding won the third. Li then pulled away, winning the next two games to put herself on the brink of another Olympic win. But Ding played herself back into it by winning the sixth game.

In the decider, Ding made fewer errors than Li, who several times missed the table with her forehand at crucial points.

Chinese women have won every gold singles medal since table tennis became an Olympic sport in 1988.

Before the Rio de Janeiro Games, China had won all but four of the table tennis gold medals at the Olympics. The country took all the golds at the past two games, and it has made a good start to doing it again in Rio. Each nation is only allowed two players in singles.

Earlier Wednesday, Kim Song I of North Korea won a bronze medal by beating veteran Ai Fukuhara of Japan.

Kim's victory capped a surprising run through the tournament. The "chopper," or defensive specialist, repeatedly took down higher-ranked opponents.

Kim lost to Ding on Wednesday morning before a small but loud North Korean cheering section, which included Choe Ryong Hae, a top lieutenant of North Korean leader Kim Jong Un.

On the men's side, London champion Zhang Jike, whose name was inspired by Brazilian soccer great Zico, will face Vladimir Samsonov of Belarus in the semifinals on Thursday. Top-ranked Ma Long of China will play Jun Mizutani of Japan.

The men's final is also on Thursday.