The 30-year-old from Sudbury, Ont., moved into the UFC rankings at No. 15 among 135-pound contenders after his Oct. 4 first-round stoppage of Roman Salazar in Halifax.
It was his fourth straight win in the UFC. It was also his 10th first-round finish and 11th win by submission.
The victory earned him a Dec. 20 matchup with Barao in the co-main event of a televised UFC Fight Night card in Sao Paulo, Brazil. The main event features middleweights Lyoto (The Dragon) Machida and C.B. (The Doberman) Dollaway.
"I didn't expect it was going to be Renan Barao but I knew I was going to get a top-10 fighter like I asked," Gagnon (12-2) said in an interview Thursday.
"I'm up for it, man. I can't wait to get in there and prove a lot of these fans wrong."
Barao (34-2 with one no contest) is ranked No. 1 among bantamweight contenders.
For the 27-year Barao, it's his first outing since May when he lost the 135-pound title to T.J. Dillashaw. The Brazilian was slated to face Dillashaw in an August rematch, but was pulled from the bout on the day of the weigh-in after falling and hitting his head while trying to cut weight.
The Dillashaw loss ended a 33-fight, nine-year win streak for the Brazilian.
"I'm not delusional. He's one of the pound-for-pound greats in the world," said Gagnon.
"I know I've got my work cut out for me but these are the types of fights I want ... this is where I want to test myself," he added.
Gagnon, who has never fought outside of Canada, is looking forward to seeing Brazil. He will get his first taste of it in two weeks to help hype the fight.
"I always wanted to travel to fight. This is my opportunity to do so, so I'm super-excited for it."
Gagnon said he took a week off after the Halifax win, ate some turkey, relaxed with his fiancee and now is looking forward to resuming training. He has won 10 of his last 11 bouts.
Gagnon lost his UFC debut to Bryan Caraway in July 2012 but still earned a US$65,000 fight of the night bonus.
The five-foot-five 135-pounder subsequently scored first-round submissions of Walel Watson and Dustin Kimura before winning a decision over Tim Gorman. Gagnon's guillotine choke win over Kimura at UFC 165 in Toronto earned him a $50,000 bonus for submission of the night.
That fight showed Gagnon's heart. He survived a painful Kimura body shot and rallied for the win when Kimura passed out from a guillotine choke after Gagnon stuffed a takedown attempt.
He gave up six inches in height to Watson but floored him with a left and then locked in a rear-naked choke for a 69-second win at UFC 152. Gagnon sat out a year after the Watson fight due to knee surgery.
Gagnon's cauliflower ears attest to an extensive grappling background.
"You don't get that ear playing tennis,'' UFC commentator Joe Rogan said dryly prior to the Kimura fight.
Gagnon, a former wrestler who took up MMA training some seven years ago, trains for his fights in the Toronto area.
He walks around at about 155 pounds, hitting 165 "if I let myself go a little bit.''
Follow @NeilMDavidson on Twitter