It was frustrating. Then dizzying. Then nail-biting.

Ultimately, though, it ended in partying for the Seattle Seahawks, who rallied from an early 10-point deficit to beat their rival San Francisco 49ers 23-17 to advance to Super Bowl XLVIII, doing so to the delight of a CenturyLink Field record crowd of 68,454.

Seattle, which outscored the 49ers 20-7 in the second half, put the game away when Richard Sherman batted a pass in the San Francisco end zone into the hands of linebacker Malcolm Smith for an interception with 22 seconds left.

That came after the 49ers drove from their own 22 with 3:32 left to the Seattle 18, appearing ready to steal the game — and the NFC title — away from the Seahawks.

But it was fittingly that a Seattle defense that led the NFL this season made the game-winning — and season-making — play.

As the game ended, players, and some fans, gathered at midfield in celebration of what is the franchise’s second Super Bowl berth in 38 years, and the culmination of the rebuilding plan of coach Pete Carroll, who the franchise hired away from USC following a dismal 2009 campaign.

“This feels even sweeter,’’ owner Paul Allen said as he accepted the George S. Halas Trophy as the NFC champion for the second time, the other coming following the 2005 season.

Just three players remain from the roster Carroll and general manager John Schneider inherited for the 2010 season. Since then, they’ve crafted a team that went 13-3 in the regular season to earn the home-field advantage for the playoffs, and then rode that to the Super Bowl.

“This team was ready to finish,’’ Carroll said of Seattle’s second-half comeback. “They were going to go out there and get it done whatever it took, and they did it.’’

Seattle had a chance to end it when the 49ers had a fourth-and-two at their own 30, with 2:01 left. But San Francisco quarterback Colin Kaepernick rolled and hit Frank Gore for 17 yards as the game stopped for the two-minute warning.

Kaepernick then hit Michael Crabtree for 16 yards to the 29 with 55 seconds left.

But the Seahawks then made the kind of play that typified their season. Kaepernick tried to hit Michael Crabtree in the end zone, but Sherman tipped the ball to Smith who cradled it in the end zone as CenturyLink erupted.

And when he did, the realization hit that the Seahawks will play the Denver Broncos, who beat New England earlier in the day for the AFC title, on Feb. 2 at MetLife Stadium in East Rutherford, N.J.

“That’s as sweet as it gets, man,’’ Sherman said.

After a staid first half that ended with the 49ers ahead 10-3, the game took head-spinning turns in the second half.

Seattle took the lead for the first time on a 35-yard pass from Russell Wilson to Jermaine Kearse with 13:44 to play on a fourth-and-seven that made it 20-17.

The Seahawks had initially lined up for a field goal, then called time and sent the offense back on the field. Aldon Smith jumped offsides at the snap, meaning Wilson knew he could throw with no risk.

Kearse had single coverage on Carlos Rogers and caught the ball as he fell into the end zone.

The Seahawks then had two chances to put the game away, getting 49er turnovers deep in their own territory, but couldn’t convert either time.