The Scot confirmed his rise up the rankings ahead of Roger Federer after a tough 165-minute battle against Ferrer to clinch the Sony Open title.
New world number two Andy Murray clinches gruelling Miami win over David Ferrer
Murray was far from his best for long periods, losing the first set and seeing his own serve frequently broken by his Spanish opponent.
But the Scot clung on for over two hours and 45 minutes, staving off a match point late in the third set, to claim a 2-6 6-4 7-6 (7/1) win, climbing above Roger Federer in the rankings and lifting the trophy for the second time in his career.
"I served poorly," he admitted afterwards.
"If I'd served better I could have made it easier and that's something I need to do better in the clay court season.
"This week I did a lot of things well but I need to serve better. If I serve better I'll be able to win matches like today more comfortably. It's easier to return on clay so it's even more important to serve well."
The match was littered with errors, particularly in the third set when neither player could hold serve in the first six games.
But it was an enthralling duel in the midday heat at Key Biscayne with neither player flinching as they scrapped to the end.
Ferrer was struck by cramps in the final-set tiebreaker, while Murray opted not to receive treatment on a tweaked ankle just to avoid prolonging the endurance test.
The tired Spaniard, who has now lost 12 of his finals appearances against top four players, admitted afterwards that Murray's stamina had been a key factor.
"I know it was a very good chance to win Miami," he added.
"It's very difficult but my life, it didn't change for one match.
"I need to work hard and to be focused for the next tournaments."
There were a total of 15 breaks of serve in a match that was both ragged and fascinating. But despite the satisfying result and the rankings boost it brings, Murray admitted he would need to do better with his serve if he was to continue winning.
The result means Murray edges ahead of Roger Federer to become the number two in the world rankings, while Ferrer moves above Rafael Nadal into fourth - both men now matching their highest ever rankings.
"That sort of match a couple of years ago I probably would have lost," Murray said.
"I was up a break three or four times in the third set and kept letting him back in through some loose shots.
"I tried to keep fighting, chased down every ball, made it as hard for him as possible.
"There was a lot riding on the match and I was glad to get through in the end."
The victory was Murray's ninth in a Masters 1000 series event.
Follow us @SprtNationalUAE