DURHAM, N.C. -- Duke guard Grayson Allen figured time was on his side on the final play of Saturday against Virginia.
He used all of it.
Allen made an awkward-looking shot from the lane as time expired to give Duke a 63-62 victory over No. 7 Virginia at Cameron Indoor Stadium.
"I knew there was enough time left to make a move," Allen said.
Allen's drive into traffic resulted in the winning basket when the ball banked in off the backboard and gave the Blue Devils their second victory of the week against a nationally ranked team.
A debate already raged on whether Allen traveled on the last play.
"It looked to me like he made a really hard shot," Virginia coach Tony Bennett said later, though he disputed the ruling on the court. "He made a huge play."
It was a sudden turn of fortunes after guard Malcolm Brogdon flipped in a shot from the lane with his back to the basket with 9.9 seconds to put the Cavaliers in the lead.
Duke called timeout with six seconds left to set up the final play.
"They used all six of those to squeeze that one out," Bennett said.
Allen finished with 15 points, but none with more impact than the final two for the sophomore.
"My mind is racing, it's going everywhere," Allen said. "Just so much excitement there at the end. Such a great moment to be in."
Duke coach Mike Krzyzewski said it was one of those magical moments at Cameron Indoor Stadium, which he called "electric."
"They should be happy and they should be really proud," the Hall of Fame coach said of his team and fans.
Bennett said the Cavaliers benefited from the experience.
"Our guys were laying it on the line," he said. "You don't have a choice in these types of settings. We got a little wobbly in stretches, but we kept our mettle and made some plays down the stretch."
Duke forward Brandon Ingram scored 25 points and carried the Blue Devils (19-6, 8-4 in the ACC) for a long stretch of the game.
Brogdon's 18 points and forward Anthony Gill's 12 points paced Virginia (20-5, 9-4), which had a seven-game winning streak snapped.
"It will sting a little bit," Bennett said. "You don't get too up. You don't get too down, because we're playing quickly again (Monday night)."
The Cavaliers have a 17-game winless streak at Duke.
Guard Matt Jones added 14 points for Duke, which knocked off Louisville on Monday night.
During a stretch spanning both halves, Ingram had 18 consecutive Duke points. He was 7-for-7 from the field during that span.
"We just tried different ways to get him isolation," Krzyzewski said of Ingram.
Even after Ingram cooled off, the Blue Devils built a 51-44 lead. Virginia had a stretch of almost five minutes without scoring, but pulled even at 53-53 with7:29 to play.
Brogdon missed twice in the final minute with a chance to put the Cavaliers ahead, but Allen missed two free throws at the 27-second mark, leaving an opening for Virginia.
Krzyzewski credited Jones' defensive work on Brogdon for making a difference throughout the game.
"I know he got 18 points, but he took 16 shots and he's a great player," Krzyzewski said of Brogdon.
Virginia led 34-31 at halftime after Duke surged with two 3-pointers by Ingram and a dunk during the last 2½ minutes of the first half. The Cavaliers shot 51.9 percent from the field in the first half.
Following a slow start for Virginia, the Cavaliers used a 13-1 burst to move to a 19-12 lead. Duke went almost six minutes without a field goal.
Reserve center Mike Tobey had eight of Virginia's first 21 points. The margin grew to 25-14 as Duke was 1-for-9 on 3-point shots.
NOTES: This is the only regular-season meeting between the teams. ... Duke coach Mike Krzyzewski turned 69 years old Saturday. ... Virginia scored more points in the second halves in 21-of-24 games this season, but it had only 28 second-half points Saturday after 34 in the first half. ... Duke failed to reach the 70-point mark against Virginia in the last seven matchups. ... Duke freshman G Luke Kennard entered the game leading the country at 91.4 percent on free throws. ... Jahlil Okafor and Tyus Jones, two stars on Duke's 2015 national championship team, were among those in the crowd as the NBA is on an All-Star break. ... Virginia has a quick turnaround with Monday night's home game against North Carolina State. ... Duke, which completed a three-game homestand, continues a four-game stretch against nationally ranked opponents with Wednesday night's game at rival North Carolina.