Williamson's contested layin with 14 seconds remaining cut the UCF lead to one. Then Barrett handled the rest, rebounding Williamson's missed free throw and putting it back in to give the Blue Devils the go-ahead basket to beat the No. 9 Knights 77-76.
"The will to win of Zion and RJ, you can't measure it. It's just there," Duke coach Mike Krzyzewski said. "Look, we're a young group. But what they did at the end of the game, willing us to win, was sensational."
Of Barrett and Williamson's performance the final two minutes, Krzyzewski said they were "built for this."
Williamson finished with 32 points and 11 rebounds, and Barrett contributed 16 points, eight rebounds and four assists.
Still, Krzyzewski didn't hesitate to call UCF's Aubrey Dawkins the best player on the court. Dawkins, who scored 32 points, narrowly missed a putback attempt with two seconds left that would have won the game.
"Heartbreak," Dawkins said of the miss that seemed to travel the circumference of the rim before bouncing out. "... When you invest this much in it, it breaks your heart."
UCF's Tacko Fall -- college basketball's tallest player, at 7-foot-6 -- made his presence felt with 15 points and six rebounds. Fall, who said Friday that he wouldn't allow himself to be posterized by Williamson, had three blocks.
According to ESPN Stats & Information research, Duke scored 20 of its 34 points in the paint with Fall off the court, including Barrett's game-winning putback.
"It was definitely a different challenge," Barrett said of facing Fall. "I'd never really played against something like that before ... but we hung in there."
Said Williamson: "He's 7-foot-6. He's a big man down there, so you just have to run the right offense for it. He played great. Hats off to him. He played a great game."
Duke moves to the Sweet 16, but Krzyzewski had to beat his former player and assistant, UCF coach Johnny Dawkins, to survive and advance.
Krzyzewski got emotional as he attempted to describe what it was like going against Dawkins. Krzyzewski improved to 28-5 in games against his former assistants.
"I love Johnny. I'm going to start crying. I love Johnny Dawkins," he said. "The moments, the times we've spent together and building the program and 10 years on our staff and the connections we've had with him at Stanford and Central Florida, we're family. I feel bad they lost. It's like a yin and a yang because they were deserving of winning."