The 27-year-old Serb has been absent since winning the Australian Open earlier this month and his stamina and temperament were tested by a spirited Canadian opponent.
Pospisil had made Andy Murray work for a win in Rotterdam last week, but he showed even more stubborn resistance against Djokovic, avoiding an early break with his booming serve.
The top seed gradually increased the pressure in the opening set, forcing Pospisil to net a backhand for a crucial break, and ruthlessly moved into a 1-0 lead.
Djokovic appeared to be making serene progress when he broke again at the start of the second, but then surrendered his own serve after a thrilling rally to tie the set up at 2-2.
Irritated by a line call, Djokovic could not conceal his frustration, and was forced to repel a string of break points while 3-2 down.
Pospisil???s moment had passed and he conceded another break with a wayward forehand before Djokovic booked his place in the second stage.
He will play Andrey Golubev of Kazakhstan in the second round.??