British hope Murray broke late in the first set but, unable to make an impact on the Croat’s serve in the second, lost a narrow tie-break.
But the world number four dominated the third set and won the tie-break in the fourth after the 33-year-old foot-faulted, the winning shot a double-hander into the corner that Karlovic could only spin wide.
The 6’10” Karlovic is famed for his service game on grass and Murray got off to the worst possible start by allowing the Croat to break him at the first time of asking.
That sloppiness was soon eradicated though, as the Scot broke straight back and he was never challenged again on serve in a first set that saw him test Karlovic on a number of occasions.
Indeed, the Croat saved set point when 30-40 down at 5-4 to Murray, whipping out some of his famed power deliveries to hold from deuce.
But he was less fortunate at 6-5, his final serve initially called an ace but subjected to a Murray challenge that showed it went a few inches wide. The verdict handed the Briton a break and the set.
Murray is one of the best returners of the game and he needed to be against Karlovic – when he did successfully connect, his superior pace and tennis brain allowed him to dominate the points positionally, although Karlovic did show his ability at the net on occasion.
The second set was a tighter affair, with neither able to come close to breaking as aces bombarded down on both men.
It came down to a tie-break, which the Croat won after Murray twice floundered on his second serve.
The third set was straightforward for the Scot as he broke at the start and the end before holding easily.
Karlovic had seemed to be flagging – he is nearing the end of his career, and the heat was taking its toll. But set four saw him reel off ace after ace as he proved impossible to hurt on serve.
That meant another tie-break, during which Karlovic’s lack of mobility ultimately cost him: a foot-fault resulted in a mini-break, which Murray ruthlessly exploited.
Murray will face Marcos Baghdatis for a place in the last 16 after the Cypriot's opponent Grigor Dimitrov was forced to retire at 5-7 1-4 down. It looked as if it was an illness-related withdrawal - the young Bulgarian had his temperature taken and an ice-pack on his neck when he called the trainer - and he managed to play just one more game before calling time on his tournament.