PYEONGCHANG, SOUTH KOREA — She knew the deepest recesses of the pain cave were waiting for her, somewhere in the final snow-covered corner of the Olympic course. So Jessie Diggins did what she always does: she put her head down, dug in hard and skied right toward it.

Diggins was tearing through the final meters of the women’s team sprint Wednesday night, in a frantic chase with Sweden’s Stina Nilsson for the Olympic gold medal. Her legs burned. Her mind grew hazy. But if she was going to make history with teammate Kikkan Randall, Diggins knew she had to charge into the pain cave—that dark, excruciating place at the end of every cross-country ski race—with no fear.

“In that last corner, I don’t know what I was thinking, except, ‘Go! Go! Go!,’’’ the Afton native said. “You’re going to have to dig really deep. I was in a lot of pain, for sure. But when your team is counting on you, you’ve got to give it everything you have.’’

Diggins plunged in, thrust out her ski at the finish line and collapsed in the snow not knowing her fate. When Randall jumped on her, it became clear: they had just become the first American women to win an Olympic medal in cross-country skiing, and it was golden.

Diggins, 26, and Randall, 35, toppled the mighty Norwegians and Swedes at Alpensia Cross-Country Skiing Centre to end an American quest that had lasted nearly five decades.

With Diggins skiing the anchor leg, they completed the six-lap race in 15 minutes, 56.47 seconds, 0.19 of a second ahead of Nilsson and Charlotte Kalla. Marit Bjoergen and Maiken Caspersen Falla of Norway also made history with their bronze medal. It was the 18th Olympic medal for Bjoergen, the most of any Winter Olympian in history.

Even they were happy for Diggins and Randall. The U.S. had won only one Olympic cross-country medal, a silver by Bill Koch in 1976. The American women had been shut out in all 46 years they had sent a team to the Winter Games. Not even the weight of that history could slow down Diggins and Randall in Pyeongchang, as they created one of the most memorable scenes of these Games.

“I was like, ‘Did we just win the Olympics?’’’ Diggins said, recalling her first words to Randall after the race. “And she was like, ‘Yeah.’ It was amazing. “It feels unreal. I can’t believe it just happened. But we’ve been feeling so good these entire Games, and just having it happen at a team event means so much more to me than any individual medal ever would.’’

The team sprint was the last Winter Games race for Randall, a five-time Olympian. After taking a year off after the 2014 Games to have a baby, she returned in the hopes of delivering the medal she had worked 20 years to earn. She and Diggins paired up to win the world championship in the team sprint in 2013, the first gold ever won by U.S. skiers at that event.

Wednesday, they achieved their Olympic milestone with flawless exchanges, smart lines, perfectly prepared skis and an unquenchable drive to win. Randall and Diggins ripped through the semifinal round, clocking the fastest qualifying time of 16:22.56. In the final, both stayed among the top three throughout a race that covers six legs of 1.25 kilometers each. Randall pulled away with Norway and Sweden on the fifth leg to make it a three-country contest, then watched as Diggins brought it home.

“If there’s anybody I’d have 100 percent faith in coming down that finishing stretch as fast as possible, it’s Jessie,’’ Randall said. “It was just a wonderful feeling to take it all in and watch it happen.’’

Diggins admitted Wednesday that the pressure to win a medal had begun to weigh on her. Though she had already made history in Pyeongchang with fifth-place finishes in the skiathlon, the 10k freestyle and the 4x5k relay--the best Olympic performances ever by a U.S. woman--she knew the American public wanted more. She had never felt that kind of strain before.

American cross-country athletes spend most of their careers toiling in obscurity in Europe, unknown to sports fans at home save for the Olympics—amounting to 17 days every four years. Suddenly, everyone seemed to care that she had not yet won a medal in Pyeongchang, and asking her to explain why, and judging her historic performances as a letdown.

Her teammates gave Diggins the strength to shake it off. They built a cocoon around themselves, where they danced and watched movies and played games in the Olympic village, allowing Diggins and Randall to shut out the expectations of the wider world.

“It’s been hard not to let it get inside my head, and race for myself,’’ Diggins said. “When I’m having fun, that’s when I’m dangerous on the race course. And if one too many people says, ‘OK! I believe it! You’re going to go win it,’ then it becomes less fun. Because winning is not the full end game for me.’’

Wednesday, the only thing she had to explain was how it all happened. She started to push the pace in the second lap, thinking she needed to wear down the Swedes and Norwegians to have a chance to win. On the final hill climb, Diggins tucked in behind them, to set herself up to build speed on the downhill and come blazing into that final corner.

“You could see it a meter before the finish line, and it was an emotional moment for everybody,’’ said Luke Bodensteiner, a U.S. Olympian in cross-country who is now an executive with U.S. Ski & Snowboard. “It was a long time coming. I was on my knees, in tears.’’

Diggins’ parents, Deb and Clay, were crying, too. They and other family members and friends hopped two fences to get to Jessie and wrap her in hugs. When she reached the finish line, Diggins said, she couldn’t feel her legs. Within moments, though, she came out the other side of the pain cave, into the light of a golden evening.

“Watching Kikkan get us in position where we knew we were going to get a medal, I thought, ‘Well, OK,’’’ Diggins said. “We’re going to try to make it a gold, then. We had nothing to lose. I wanted to make this happen for this team.’’