Andy Murray moved up to second spot in the world rankings after beating David Ferrer 2-6 6-4 7-6 (7-1) to win the Sony Open title in Miami.