Spain won the Hopman Cup for a fourth time following a straight-sets doubles victory against Serbia in the final in Perth.