RIO DE JANEIRO — Out of sorts and out of answers, defending champion Serena Williams is out of the Rio de Janeiro Olympics.

Shanking shots of all sorts, including five — yes, five! — double-faults in one game alone, Williams lost to Elina Svitolina of Ukraine 6-4, 6-3 in the third round in a real shocker Tuesday, ending the No. 1-seeded American’s bid to become the first tennis player to collect a pair of singles golds.

Against an unheralded opponent who at times couldn’t seem to miss, Williams had problems right from the start, when she got broken to fall behind 2-1 with a badly missed overhead into the net.

By match’s end, Svitolina had won 63 points, but merely nine came via clean winners of her own doing. The others came thanks to Williams’ 37 unforced errors and 17 forced errors.

After winning golds in singles and doubles at the 2012 London Olympics, Williams heads home from Brazil with nothing. She and her older sister Venus, who sat in the stands Tuesday, lost in the first round of doubles — their first defeat in the Olympics after going 15-0 with three golds.

The 20th-ranked Svitolina, meanwhile, never before played in the Olympics and only once has been to a major quarterfinal. She also entered the night 0-4 against Williams, an owner of 22 Grand Slam singles championships.

After all of 45 minutes, she was up a set and a break at 2-1 in the second. She got to break point with a big forehand that forced an errant forehand from Williams, then converted with an inside-out forehand return winner off a 97 mph (157 kph) second serve.

When she held in the next game, it was 3-1, and Svitolina was merely three games from a monumental upset.

But Williams did not go quietly.

Screaming “Come on!” after some points and “Ahhhh!” after others, waving her arms either to celebrate or remonstrate herself, she held, then broke, to pull even at 3-all in the second set. And then one of the greatest fighters in her — or any other — sport simply faded down the stretch.

Oddly so, too, with all of those double-faults. At one point during that game, which ended with her getting broken to trail 4-3, Williams leaned forward and tapped her racket twice against the court. She did, however, refrain from smashing it the way she did a night earlier, cracking the equipment against her sideline chair during a ragged first set.

On Monday, Williams managed to turn things around, as she so often does. This time, though, she never could.