PORTLAND, Oregon -- Duke coach Mike Krzyzewski calls Marvin Bagley III a treasure.
The freshman big man had a career-high 34 points and added 15 rebounds, and No. 1 Duke rallied to defeat Texas 85-78 in overtime on Friday in the semifinals of the PK80 Invitational.
"I believe ultimately in this kid. I knew he was going to be good, but coaching him every day, he's a treasure, really," Krzyzewski said. "Because he wants to be really good. All of his teammates love him because he's as hard of a worker as we have."
Gary Trent Jr. added 17 points for the Blue Devils (7-0), who trailed by 16 points in the second half and were forced to play five freshmen once senior Grayson Allen fouled out.
Duke advanced to play the winner of Friday night's late game between No. 7 Florida and No. 17 Gonzaga for the title on Sunday.
Dylan Osetkowski had 19 points and seven rebounds for Texas (4-1), which fell short of its first-ever victory over a top-ranked team.
Bagley had consecutive dunks to give the five-time NCAA champion Blue Devils a 78-73 lead in overtime. Andrew Jones' layup pulled Texas within 78-77 with 1:20 left. Wendell Carter's put-back dunk pushed Duke's lead to 82-78 and Trent's free throws with 11 seconds left sealed the win.
"The game kind of slowed down and my teammates found me in the right spots. Coaches, they called plays for me and they believed in me to keep attacking and going to the rim, just trying to create something," said Bagley, who had 21 points in the second half and overtime.
Bagley tied the Blue Devils' freshman scoring record set by J.J. Reddick on Jan. 15, 2003, against Virginia.
"He has it," Krzyzewski said of the 6-foot-11 forward. "He just has to keep developing it."
Duke trailed by as many as 16 points in the second half, but Bagley's short jumper tied it at 70 and put the Duke fans in the crowd on their feet. Allen fouled out with 2 minutes left in regulation and Kerwin Roach II dunked to put Texas back in front 72-70.
Trent made a layup and his free throw gave Duke a 73-72 lead with 32.8 seconds left. Matt Coleman made a free throw on the other end to re-tie it but missed the second and the game went to overtime.
It was the sixth biggest comeback in Duke history.
The Blue Devils struggled throughout the game from the perimeter and at times from the free-throw line. Duke made just three of 18 3-point attempts for the game and finished with 22 of 36 free throws.
Carter finished with 114 points and 11 rebounds.
Mohamad Bamba, the Longhorns' 6-11 freshman with a 7-9 wingspan, finished with nine points and 10 rebounds but fouled out with 32.8 seconds left in regulation. Bamba had two blocks.
"We showed how good we can be, but obviously there's a lot of things we have to grow on and get better from. And we have to understand the game is 40 minutes long , or in this case, 45 minutes long," Texas coach Shaka Smart said.
The three-day tournament, which is nicknamed the PK80, celebrates Nike co-founder Phil Knight's 80th birthday. The event takes a break on Saturday before resuming on Sunday.
Duke and Texas were in the Motion Bracket, playing Friday at the Moda Center, home of the Portland Trail Blazers. Teams in the Victory Bracket played at the adjacent Memorial Coliseum.
Roach beat three defenders for a decisive dunk that gave Texas a 42-29 lead and the Longhorns led 43-31 at the break. Roach hit two decisive dunks in the first half, mugging for the courtside cameras.
Texas wasn't much better than Duke from 3-point range, making just four of 23 tries.
It was the fifth meeting between the teams and Duke has won all of them.
Duke: Bagley is the first Duke freshman to have five double-doubles over his first seven games.
Texas: Kemba Hepa, a senior power forward at Portland's Jefferson High School, committed to Texas this past week. The four-star recruit also considered Gonzaga.
AGAINST No. 1: Texas had faced a No. 1-ranked opponent nine previous times, with a 0-9 record. The most recent meeting was on Feb. 29, 2016, when the Longhorns lost 86-56 to No. 1 Kansas.
HOW THEY GOT THERE: The five-time NCAA champion Blue Devils defeated surprisingly resilient Portland State 99-81 in their tournament opener on Thursday. Bagley had 18 points and 15 rebounds in the win.
Texas advanced with a 61-48 victory over Butler. Jones had 16 points while Bamba had six points and 12 rebounds along with four blocked shots.
Duke faces the winner of Friday's late game between No. 17 Gonzaga and No. 7 Florida.
Texas plays the loser of Florida-Gonzaga.