Spain defeated Serbia 2-1 to win the Hopman Cup for the fourth time on Saturday.

Fernando Verdasco and Anabel Medina Garrigues claimed the title by winning the mixed doubles 6-4, 7-5 from Novak Djokovic and Ana Ivanovic after the singles were shared.

Serbia had been seeking its first win in Perth.

Djokovic took the first match for Serbia by overcoming a strong challenge from Verdasco 6-3, 7-5. Medina Garrigues levelled the tie by outlasting Ivanovic 6-4, 6-7 (3), 6-2.

Djokovic began strongly and led 3-1 when Verdasco put a backhand wide, and that break was enough to determine the outcome of the first set.

Although Djokovic was dominant in the opening stages, Verdasco stepped up his game towards the end of the first set and into the second.

His efforts were rewarded when he fought off two break points in the first game of the second set and broke for 2-0 with a forehand winner down the line.

Djokovic broke back in the fifth game when Verdasco made a backhand error, and although he failed to convert two more break points at 4-4 he claimed a vital break to lead 6-5 when Verdasco netted a forehand.

"It's difficult to play against any player if he hits the winners from both sides and is very aggressive," Djokovic said of his second-set struggle. "He was serving at over 200 kph consistently well and it was really hard for me to come back to the match."

Ivanovic looked nervous and struggled with her first serve, and at one stage appeared to be suffering from illness.

She was 2-0 up but Medina Garrigues immediately broke back on her sixth break point before breaking again at 4-4 and serving out the set at love, closing it with an ace.

Ivanovic led 2-0 again in the second set but called for the trainer and was given some medication.

The Serb went on to lead 5-2, failed to serve out the set at 5-3 and eventually took the tiebreaker with ease.

In the final set, Medina Garrigues led 2-0 when Ivanovic double-faulted and went on to claim victory when Ivanovic netted a backhand on break point at 5-2 after a draining 2 hours, 38 minutes.

"I was dreaming all of my career of winning against a great player in a big stadium, and I'm 30 years old and finally I take it so I'm really happy," Medina Garrigues said. "The crowd is like a Grand Slam and they were supporting me because they wanted a live mixed doubles."