BUDAPEST, Hungary (AP) — After years of silver medals, Mireia Belmonte has developed a taste for gold.

At the world championships on Thursday, Belmonte added the 200-meter butterfly title to her Olympic crown.

"What mattered the most was winning, because I never won this medal before. It's been a perfect day for me," Belmonte said.

The Spanish swimmer became the first Olympic champion to win the world title in the women's 200 fly since Poland's Otylia Jedrzejczak in 2005.

"It's one of the bigger medals that I didn't have, that now I have, and I'm really, really happy with it. I still can't believe it's true, it still hasn't sunk in," Belmonte said, hours later.

The 26-year-old's main rival was home favorite Katinka Hosszu, who was going for a record-equaling third medal in this event after claiming bronze at the worlds in 2009 and 2013.

"It's always difficult to swim against Katinka. It's even more difficult to do it here with the crowd," Belmonte said. "But you can't go into the swimming pool thinking she's going to be better because she's swimming here, that you're going to lose. You have to go and fight, be it here or anywhere else in the world."

Roared on by the raucous crowd at the Duna Arena, Hosszu - who won the 200 medley in electrifying fashion on Monday - raced into the lead and kept it to the halfway stage. Belmonte made her move with more than 50 meters remaining and won in 2 minutes, 5.26 seconds.

Germany's Franziska Hentke finished second, while Hosszu had to be content with another bronze after fading to third.

After seeing that she had won, Belmonte lifted her goggles, covered her mouth in disbelief, then raised her right arm in triumph before smashing it down on the water and clenching her fist for another shake.

"It was a very difficult race because I had a lot of good swimmers in all the lanes," said Belmonte, who said she was feeling poorly when she woke up Thursday morning.

"When I woke up I thought, 'I want to be best.' I was recovering during the day. Now I'm feeling better," she said. "For me it was very special to win because I never won a gold medal in a world championships."

Coming after her Olympic success, the world title helps make up for years of near misses.

Belmonte was second behind Jiao Liuyang in the women's 200 butterfly at the 2012 Olympics, where she also claimed silver in the 800-meter freestyle.

Then in the women's 200 fly at the worlds in Barcelona the following year, Belmonte finished behind Liu Zige, another Chinese swimmer, despite setting a national record. She also claimed silver in the 400-meter medley and 1500-meter freestyle, as well as bronze in the 200-meter medley.

Belmonte missed the 2015 worlds in Kazan, Russia, due to injury but returned to finally claim her first gold by three-hundredths of a second in the 200 butterfly in Rio.

"I know it's the same event but it just feels different here," Belmonte said of winning the world title after gold in the Olympics. "It's different. I'm very happy now."