SANTA CLARA, Calif. (AP)The San Francisco 49ers got tested for a half in their playoff opener and then everything started to click in the second half.

With more performances such as that, the Niners will be a very tough out this postseason.

San Francisco scored the first 25 points of the second half to turn a one-point halftime deficit into a lopsided 41-23 victory over the Seattle Seahawks in a wild-card game on Saturday.

”I was a little nervous just because of how the tide was going, but I have great confidence in this team,” defensive end Nick Bosa said. ”An entire half of football is a lot of football and we did exactly what we’re supposed to do.”

Brock Purdy threw two TD passes, ran for a third score and posted a perfect passer rating after halftime to lead the offense on four straight scoring drives.

The defense had two takeaways and didn’t give up any points after halftime until the game was well under control in the final two minutes.

”We knew what our plan was coming out of halftime into the second half and I thought we just executed everything and we finished drives where we didn’t do the stalling,” said Purdy, who became the first rookie ever to account for four TDs in a playoff game. ”We didn’t overthink things in the second half.”

The 49ers advanced to the divisional round, where they will host Dallas on Sunday.

Everything changed for San Francisco with one twist of Deebo Samuel’s previously injured left ankle. The play on the opening drive of the half provided the spark the Niners needed.

”I think that pissed a lot of people off. I think it pissed our team off and I think you could kind of feel our team react to that after,” coach Kyle Shanahan said. ”I wish we were like that from the first play always, but sometimes when some stuff motivates the guys, I think it was cool to see us rally together and I know Deebo was bothered and it was cool we came back and answered.”

WHAT’S WORKING

Offense. Outside of settling for field goals, the Niners moved the ball with ease. They scored on eight drives with one punt in the first half and kneeling down to end the game in the fourth quarter. Samuel led the way with 165 yards from scrimmage and Christian McCaffrey had 136 as San Francisco averaged 7.89 yards per play and finished with 505 yards. The 49ers are the second team to gain at least 500 yards, score at least 40 points and have no turnovers in a playoff game. Kansas City did it last year in the division round against Buffalo.

WHAT NEEDS WORK

Squib kick. Robbie Gould’s poor squib kick at the end of the first half ended up costing San Francisco three points. Colby Parkinson fielded it at the 24 and returned it 14 yards to the 38 with 9 seconds left. Geno Smith scrambled for 9 yards on the next play and a late hit penalty by Jimmie Ward set up a 56-yard field goal by Jason Myers that gave Seattle a 17-16 halftime lead.

STOCK UP

Charles Omenihu. The backup defensive end delivered the play of the game when he had a strip sack of Smith in the red zone in the third quarter with San Francisco protecting a six-point lead. Omenihu added another sack for his first career two-sack game. His previous high came in the wild-card round against Dallas last year when he had 1 1/2 sacks and a forced fumble.

STOCK DOWN

Charvarius Ward. San Francisco’s top cover cornerback had a rough day against DK Metcalf. Ward allowed six catches on eight targets in coverage, according to Pro Football Focus, and was beaten for a 50-yard TD catch.

INJURIES

DE Samson Ebukam and WR Jauan Jennings are day to day with ankle injuries.

KEY NUMBERS

10.39. The Niners averaged more than 10 yards after the catch on their 18 receptions, according to Sportradar, led by 66 yards on Samuel’s 74-yard touchdown in the fourth quarter. That’s the second-most yards after catch per reception in the past 10 postseasons, trailing the 12.08 for Pittsburgh against Miami in a wild-card game following the 2016 season.

WHAT’S NEXT

The Niners will face the Cowboys for second straight year in the postseason after winning 23-17 in the wild-card round last year. This is the record-tying ninth playoff meeting between the teams with Dallas winning five of the previous eight. That ties 49ers-Packers and Cowboys-Rams for the most common playoff matchups in NFL history.

AP NFL: https://apnews.com/hub/nfl and https://twitter.com/AP-NFL