Murray outlasts Ferrer to win Miami Masters