RIO DE JANEIRO (AP) — Bethanie Mattek-Sands figures she'll retire the stars and stripes socks and frame them with her gold medal.

In an all-American mixed doubles final Sunday, Mattek-Sands and Jack Sock won the title as first-time Olympians. And they did it against an opponent who has won as many medals — and as many golds — as any tennis player in history.

Mattek-Sands and Sock beat Venus Williams and Rajeev Ram to deny Williams a record fifth gold. With the silver, Williams still tied the Olympic mark with her fifth medal: Kathleen McKane also won five (one gold) in the 1920s.

Williams owns one singles gold and three in doubles with sister Serena, but she was upset in the first round in Rio de Janeiro in both tournaments while battling a virus. Her Olympics were seemingly over since she wasn't originally expected to compete in mixed doubles.

Ram, meanwhile, wasn't even originally supposed to be in Rio. The 32-year-old was added to his first Olympic roster a few days before the opening ceremony when the 2012 men's doubles gold medalists, Bob and Mike Bryan, withdrew.

Sock was also sick before arriving in Rio — he was diagnosed with walking pneumonia shortly before departing. And he, too, was upset in the first round in singles, sounding afterward more like a tourist than a medal contender.

"I wanted to enjoy the experience, soak it all up," he recalled Sunday.

He wound up soaking up two medal ceremonies, also winning bronze with Steve Johnson in men's doubles.

For the 31-year-old Mattek-Sands, who like Sock has won major titles in both doubles and mixed doubles, colorful knee-high socks are a signature fashion statement. The American flag set she wore Sunday was not an Olympic original — she debuted them at a past U.S. Open.

"It was kind of a last-minute pack," she said. "I was like, 'You know what? I think this is the moment. If I'm going to go hard-core USA, it's going to be at the Olympics.' So I pulled them out for the match today."

Her playing partner couldn't help but make the obvious pun — she'd be framing some socks alongside a medal she won with a guy named Sock.

They laughed and high-fived, and Mattek-Sands said, "It's too perfect to actually not do that."

The two American teams split the final's two sets, then Mattek-Sands and Sock won the match tiebreaker 10-7. It could have been the last Olympic outing of Williams' career, though she wouldn't rule out a sixth games as a 40-year-old in 2020.

"It's totally about whether I want to be there, whether I want to continue to work this hard," she said.

The same question was posed to Martina Hingis, who turns 36 next month and also lost in a final Sunday — in women's doubles with Swiss teammate Timea Bacsinszky to Russians Ekaterina Makarova and Elena Vesnina by a score of 6-4, 6-4.

Way back in 1997, Williams played in her first major final at the U.S. Open, defeated by Hingis. A year earlier, Hingis took part in the Atlanta Games — and she hadn't been to another Olympics until now, two decades later.

On Sunday, both Williams and Hingis won silver, the first career medal for the Swiss star — a feat that takes on extra resonance after she repeatedly came out of retirement.

"When you're winning Grand Slams, No. 1 in the world, at 16, you think you have another 10 years at least at the top of the game," she said. "Now I know it's coming toward the end."

How soon is the end? Hingis didn't want to talk about 2020 — though Bacsinszky is trying to recruit her for the Tokyo Games.

The Olympics were always a goal for Makarova and Vesnina, bigger than their two major titles together, they insisted. They took it so seriously that Makarova was crying when she didn't play well in practice.

"I just really wanted this medal and I was emotional: 'Why am I not playing my best tennis right now?'" she recalled.

They played their best tennis at the right time.