Djokovic beat Sinner 3-6, 6-4, 4-6, 6-4, 6-4 to claim his first victory over the Italian in six meetings.