Pospisil, ranked 40th in the world, admitted that he was shocked to have finished the tough one-hour 45-minute match with Dodig after being unable to move his neck the morning of the match.
"I woke up fine at 7:00 but then fell back asleep and slept in a bad position for 90 minute from 8:00 to 9:30," said Pospisil. "I couldn't move my neck to the left.
"I honestly didn't know if I'd be able to play at all," said the rising star who has reached all three of his career ATP semifinals (Bogata, Montreal and Basel) this breakthrough season. "I had a lot of treatment and painkillers.
"It was still bothering me on every single shot, especially the serve and forehand. But the trainer told me I couldn't make it worse so I gave everything I had. I'm still very surprised that it held up as well as it did, frankly. It's shocking."
Federer beat Pospisil in their only other meeting in Montreal two years ago, but the young player from Vancouver is excited to get another chance at the Swiss icon.
"It will be incredible to play him, it will be one of the highlights of my career," Pospisil said. "Playing him in his hometown will make it even more special. It will be a very special match for me."
Pospisil needed nearly an hour to win the gruelling first set against Croatia's Dodig.
The tiebreaker created stress on both sides of the net, with Pospisil saving three set points and finally converting for the win on his own fourth set-winning opportunity.
In the second set, Pospisil broke for a 3-2 set lead only to lose it a game later. But Pospisil dug in to break Dodig again for a 5-4 lead. He finished off the victory a game later on his second match point as Dodig hit the net with a return.
"It was really tough to concentrate," said the injured winner. "It's very draining to play that way. But I'm really thrilled to go through like this."
Pospisil is hoping to improve his ranking enough this weekend and next week in Paris at the last event of the regular season to reach the top 32, which would guarantee a seeding for the Australian Open."
He said the trainer told him his condition is a two or three-day affair, with the first day the worst. He is expecting no physical problems when he plays for a spot in the his first ATP final at the weekend.
But he admitted that the situation was a close call.
"I could not have played a 1 p.m. (match)," he said. "But two hours later I was loose enough to be able to serve almost normally, thanks to all the treatment.""