Andy Murray earned the year-end No. 1 ranking and his first title at the ATP finals on Sunday, beating Novak Djokovic 6-3, 6-4 in the last match of the tennis season.

The Wimbledon champion, who took over from Djokovic as the top-ranked player two weeks ago, needed to win on Sunday to ensure he finished the season as the No. 1-ranked player in the world for the first time.

Murray started with a pair of double-faults in the opening game, but it was soon Djokovic that was struggling with his serve. The second-ranked Serb was broken once in the first set and twice in the second as the unforced errors piled up.

Normally so steady with his groundstrokes, Djokovic found himself missing easy shots time after time, finishing the match with a whopping 30 unforced errors and only 13 winners. Murray had 15 unforced errors and 13 winners.

In the first set, Djokovic had a routine smash that he whacked wide. And in the second, he netted a basic forehand volley.

It never got much better for the 12-time Grand Slam champion, who was trying to win a record-tying sixth title at the season-ending tournament and finish the year as the top-ranked player for the fifth time.

Murray is the first man other than Djokovic, Roger Federer or Rafael Nadal to finish the year as the No. 1-ranked player since Andy Roddick in 2003.

He took over the top spot on Nov. 7 after winning his eighth title of the season at the Paris Masters. He also reached the Australian Open and French Open finals, losing to Djokovic on both occasions, but won his second straight Olympic gold medal in singles at the Rio de Janeiro Games after claiming his second Wimbledon title.

His victory on Sunday was his 24th straight, and the first time he has beaten Djokovic indoors after four previous losses.

Despite winning the opening two Grand Slam tournaments this year, Djokovic has struggled in the second half of the season. He lost to Sam Querrey in the third round at Wimbledon, ending a 30-match winning streak at major championships. He later lost to Stan Wawrinka in the U.S. Open final.

Sunday's match was the first time since 2000 that the year-end No. 1 ranking was on the line in the final match of the season. Sixteen years ago, Gustavo Kuerten beat Andre Agassi to give the Brazilian the top ranking ahead of Marat Safin.