Murray, who turns 27 today, was broken in the opening game and faced several other nervy moments, but managed to take the first set to a tie-break, where he won 15 of the next 16 points to gain a stranglehold on the contest.
Despite being a set and a break down, Melzer battled back although Murray was equal to the challenge and closed out a 7-6 (7/1) 6-4 win to book a last eight showdown with either world number one and reigning champion Rafael Nadal or 14th seed Mikhail Youzhny.
The Scot is starting to find some encouraging form as he bids to mount a challenge at the French Open, which gets under way later this month.
But he made a sluggish start at the Foro Italico, with Melzer, whose injury problems have seen him slip to number 67 in the ATP rankings, breaking the seventh seed in the opening game.
The Austrian looked to be in fine touch early on, but Murray, who had won all five of his previous meetings with Melzer, hit back to level things up at 3-3.
Murray was on the back foot once again, though, and was made to save five break points in the ninth game, and Melzer's failure to capitalise would come back to haunt him as the first set went to a tie-break.
Wimbledon champion Murray found another gear to open up a 6/0 lead with some fantastic attacking play and he sealed the set at the second attempt.
The two-time grand slam winner immediately broke Melzer to love at the beginning of the second set although his lower ranked opponent would refuse to give in and although Murray saved a break point in the fourth game, he dropped his serve in the sixth.
But Murray broke straight back to finally break Melzer's spirit, sealing victory with an ace after an hour and 41 minutes.
Murray admitted he would relish the chance to play Nadal for the first time since 2011.
The pair have met 18 times, with the Spaniard leading the head-to-head 13-5, including a straight sets win in their 2011 French Open semi-final.
Yet injuries to both players have kept them apart for their last couple of years, but Murray welcomes the chance to renew their rivalry.
"I'd love to play against him, it's be a great match for me with the French Open just around the corner because I'll see where my game's at and where I need to improve," Murray said.
"I haven't played for a long time, it's been at least two and a half, three years since we played."
He added: "This week I've wanted to try and play solid tennis as much as possible and I did a pretty good job today."