Murray captured his 26th career tour title, and second of the year having taken the Brisbane crown, after a grueling two hours and 45 minutes.
“Both of us fought hard,” Murray said. “Both of us were struggling physically at the end. I was lucky to come through.”
It was the second Miami title for Murray, who won the title in 2009 but lost last year’s final to Novak Djokovic.
Murray will rise to World No 2, bumping his way ahead of Roger Federer, while Ferrer will move past Rafael Nadal to become fourth.
Photos: Katrina Kaif, Shamita Shetty at Mumbai airport
Photos: Varun Dhawan, Alia Bhatt promote 'Badri...' on 'Dil Hai Hindustani'
In pictures: 15 facts about kissing that will surprise you
Photos: Shahid Kapoor and Mira Rajput at cafe in Bandra
Photos: Deepika Padukone, Neha Dhupia and Soha Ali Khan at event