Kiara Pickett sneaked a goal into the lower left corner of the net, slid on both knees, and was mobbed by her teammates as Stanford beat North Carolina 0-0 (5-4 on penalty kicks) in front of 9,591 fans on Sunday night at Avaya Stadium.

A historic season by Stanford (24-1-0) fittingly ended with the NCAA’s first championship that had to be decided by penalty kicks after 90 minutes of regulation and two overtime periods went scoreless.

“I’m really glad that it was a challenging game and that we came through in the end, because it makes it even more special,” Stanford head coach Paul Ratcliffe said. “It wasn’t an easy win. It was a challenging match, and we go away thinking: ‘Wow, that was a tough game and a great accomplishment.’”

The No. 1 Cardinal, who led the country in nearly every offensive category, outshot No. 2 North Carolina 21-12 and earned 14 corner kicks to the Tar Heels’ three, but Stanford couldn’t capitalize until the game went into the penalty-kick format.

After extending both arms and running the length of the field while mimicking an airplane, Stanford goalkeeper Katie Meyer made a diving save to turn away Taylor Otto’s attempt that opened the best-of-five shootout.

Catarina Macario gave the Cardinal a one-goal lead that lasted until Carly Malatskey had her shot blocked and Lotte Wubben-Moy’s rocket sent the shootout into a sudden-death format. Meyer stopped Tori Hansen’s shot to set up Pickett’s moment.

“I had already mentally started celebrating,” Meyer said.

Actually, she had already starting celebrating outwardly, too. Meyer found an ESPNU camera, pointed at the Stanford script on her chest and mimed zipping her mouth even before Pickett’s goal won it.

“She’s a big personality and a great competitor, and you have to be, because there are so many nerves and so much anxiety in those moments,” Ratcliffe said of Meyer, who stopped two of the six penalty kicks she faced. Stanford converted five of its six chances, including Pickett’s clincher.

In celebration of the program’s third national title, the Cardinal got up from their dogpile on Pickett, raced around the field to thank the 10th-largest crowd in College Cup history and then put on championship T-shirts that put the final stamp on a remarkable season.

Stanford, which also won titles in 2011 and 2017, finished the season on a 19-game winning streak and outscored opponents 76-8 during the span. The Cardinal racked up a program-record 102 goals.

“We had an opportunity to win against an extraordinary team,” North Carolina head coach Anson Dorrance said. “I’m certainly very proud of that, but I don’t want to pretend like we deserved to win or anything. They certainly were down our throats.”

Macario, the nation’s top player, had trouble getting involved in a game until the second half. The NCAA leader in goals (32), assists (23) and points (87) peppered the Tar Heels’ defense with six shots that couldn’t quite find the back of the net.

Through tears, Dickey said the loss hurt especially, because North Carolina considered this a “redemption year” after losing 1-0 to Florida State in last year’s title game. But Dorrance refused to call it a loss.

“They didn’t lose the game. They tied the game. There’s this thing called a penalty-kick shootout to determine the national champion. That’s not a loss,” Dorrance said before a reporter said the young Stanford and North Carolina rosters could meet again in the 2020 championship. “Can’t wait.”

Rusty Simmons is a San Francisco Chronicle staff writer. Email: rsimmons@sfchronicle.com Twitter: @Rusty_SFChron