TALLAHASSEE, Fla. (AP) — Nick Weiler made a 54-yard field goal as time expired to give No. 23 North Carolina a 37-35 win against No. 12 Florida State on Saturday, snapping the Seminoles' 22-game home winning streak.

It was the first field goal make by either team after their respective kickers missed their first four attempts. Weiler also atoned for a blocked extra point that allowed the Seminoles to take a late lead.

"I knew it was within his distance. That wasn't the issue," North Carolina coach Larry Fedora said. "He had something to prove. After the extra point got blocked I talked to him on the sideline and said he had to get it out of his head. He got his mind right and we gave him his shot."

After Florida State took a 35-34 lead with 22 seconds remaining on a Deondre Francois 2-yard touchdown run, the Tar Heels were able to drive 38 yards in three plays. They also took advantage of a pass interference call on Florida State's Tavarus McFadden to get them in range.

It is the second straight week that the Tar Heels (4-1, 2-0 Atlantic Coast Conference) have won in the final seconds. Last Saturday, they defeated Pittsburgh 37-36 with two seconds remaining on a Mitch Trubinsky touchdown pass.

Against Florida State, Trubisky had his third straight 400-yard game, completing 31 of 38 passes for 405 yards and three touchdowns. Ryan Switzer, who had 16 catches last week, had 14 receptions for 158 yards.

The Tar Heels took a 34-28 lead on a 34-yard touchdown reception by Thomas Jackson, but Florida State's Wally Aime blocked Weiler's point-after attempt. Florida State (3-2, 0-2) then drove 75 yards in nine plays, culminating in Francois' score. The freshman quarterback looked like he was going to be sacked at the North Carolina 8 but eluded tackles by Mikey Bart and Malik Carney to score.

Dalvin Cook accounted for 256 yards of total offense — 140 yards rushing and 106 receiving — along with three touchdowns. It marks the first time he had gone over 100 yards rushing and receiving in the same game. Francois was 20 of 32 for 372 yards.

Florida State had the nation's longest active home winning streak. It is the Seminoles first home loss since falling to Florida in 2011.

"We had some critical mistakes in games, didn't finish drives early in games. Had some penalties," Florida State coach Jimbo Fisher said. "We have to play better. We have to do better. In all three phases. There's a lot of good there. There's way too much bad."