The pair were involved in one of Wimbledon’s most memorable encounters at the same stage three years ago when the British No 1 battled back from two sets and a break down to triumph.
It was a slightly patchy performance last night from Murray, who played an unimpressive second set and was then broken when he served for victory.
But he eventually completed the job in the fourth-set tie-break just before 10pm to the delight of a packed crowd, prevailing 6-4 4-6 6-1 7-6 (7/4).
The 24-year-old said: “It was a tough one.
“Both of us were struggling a bit behind our second serves. He made a couple of huge returns.
“You have to come through really tough periods sometimes.
“It’s very intense. I thought I played very good tennis from the back of the court, I just need to serve better. It’s a step in the right direction.”
Asked what marks out of 10 he would give himself so far, Murray added: “An eight.
“I thought tonight’s match was a very high standard.”
Ljubicic, had never been past the third round at Wimbledon in 11 previous attempts, a surprise given the 32-year-old’s big game, and Murray would certainly have been aware of the danger after losing to him three times in six meetings.
The world No 4 – now the lone British representative in the singles events – had the advantage of having played under the roof twice before, while for his opponent the match fulfilled a long-held ambition to play on Centre Court.
Murray saved a break point in game three and had a golden chance three games later when he moved to 0-40 but this time it was Ljubicic’s turn to find the big serves when he needed them, seeing off four break points in total.
That gave the Croatian a lift and he was not so generous when Murray faltered in the next game, sealing the first break when the fourth seed netted a forehand.
The home hope was in serious danger of losing the opening set but he chipped away as Ljubicic looked to consolidate the break and levelled at 4-4 thanks to an untimely double fault.
Suddenly it was Murray on the front foot and he made it three games in a row and the set by taking his second set point courtesy of a superb forehand winner.
Having got his nose in front, Murray promptly played his worst service game of the tournament, throwing in a double fault on break point to trail immediately at the start of the second set. And this time there was no way back.
The encounter with Gasquet was suddenly looking an awfully long way away, but Murray responded in perfect fashion by breaking the Ljubicic serve at the start of the third set.
The Croatian was making a few too many unforced errors and a netted volley gave the fourth seed a 2-0 lead. Murray was looking full of confidence again and a brilliant backhand down the line brought up break points in the next Ljubicic service game, with another mistake costing the Croatian.
He at least avoided the dreaded bagel but Murray had stepped up impressively.
Both players began the fourth set playing at a very high level and, after saving a break point in the second game, Murray brought up one of his own with a super lob only to miss a makeable forehand. A challenge to HawkEye was optimistic in the extreme.
There was no stopping the 24-year-old in the fifth game, though, and, after a stunning passing shot Ljubicic could only guide a volley into the net.
The crowd had been fairly subdued but they roared their approval as Murray moved 3-2 in front. They were even more excited when Murray brought out the through-the-legs shot he had debuted at Queen’s for another winner in the seventh game, although Ljubicic went on to hold.
Discussing the shot, Murray said: “It was just one of those things, it was in the right position. I tried it at Queen’s and in practice and it just went it. You don’t get the chance to try it very often.”
The Croatian had a trick up his sleeve as well, though, firing a stunning backhand winner off a Murray first serve to bring up two break points with his opponent serving for the match. And this time the 24-year-old could not save himself.
Having been in control, Murray needed to win a tie-break to avoid a deciding set.
Neither man cracked until the eighth point, when a forehand error from Ljubicic gave the Scot a 5-3 lead, and this time he made no mistake, sealing victory on his second match point with a forehand winner.