The World Cup quarter-finalists were blown away in a 10-minute spell midway through the first half but recovered to finish the game strongly.
The Lions scored four tries but suffered a potentially grievous blow when captain Alun Wyn Jones suffered an apparent shoulder injury in the early minutes.
The Welshman will face an anxious wait ahead of the squad’s departure for South Africa on Sunday.
Scotland winger Duhan van der Merwe was among the try-scorers and there were also scores for Josh Adams, Tadhg Beirne and Robbie Henshaw.
Fans were inside Murrayfield for the first time since August 2020, with 16,500 roaring on the Lions in what could be the only game they play in front of supporters this summer.
They ran out to Public Enemy’s Harder Than You Think but the precarious nature of the sport was laid bare after only seven minutes.
No-one could doubt the toughness and durability of Jones but when the skipper stayed down after being cleared out at a ruck it looked ominous.
Sure enough, when he got to his feet he had to be helped from the field, trudging off with his left arm hanging limp.
Courtney Lawes replaced the Welshman, with hooker Ken Owens taking over the captaincy.
The game - the Lions’ first on home soil since 2005 - had begun in a disjointed fashion, hardly surprising given the hurried nature of their preparations. But it didn’t take long for the composite side to find their feet and three tries in ten minutes had them in the driving seat by the midway points of the first half.
The first came as the Lions patiently built the phases after securing lineout ball in the Japan 22, Josh Adams going over in the corner.
The home side run into trouble almost immediately from the restart when Conor Murray’s attempted clearance was charged down by Atsushi Sakate, the Japan hooker. Fortunately for the Lions, Dan Biggar was alert enough to clear the danger.
The ground was only quarter full but the noise levels were impressive and it went up a notch in the 17th minute when Duhan van der Merwe scored the Lions’ second try.
The Scotland winger has taken to Test rugby like a duck to water with 10 scores to 12 matches and he continued his streak on his Lions debut, picking the ball out of a ruck on the Japan 22 and surging to the line to touch down in the same corner as Adams.
There was another injury concern when Justin Tipuric was replaced by Taulupe Faletau but it didn’t stall the Lions momentum as Robbie Henshaw profited from a lineout maul for try number three.
Biggar converted all of them to give the Lions a 21-0 lead which was how it stayed for the remainder of the half.
The Lions fans were happy enough with that and the only sour note was the announcement that the bars would not be opening at half-time, prompting a chorus of boos. As if to rub salt in the wounds, the intoxicating smell of the nearby brewery began to waft over the stadium.
Unable to slake their thirst, those inside Murrayfield had to make do with a half-time kicking competition which involved Scotland international stand-off Duncan Weir booting the ball high in the air for members of the A League of Their Own team to catch.
Jamie Redknapp impressed; the rest didn’t.
Japan began the second half brightly and Kotaro Matsushima thought he was in for a try, only to be hauled back by referee Pascal Gauzere for an earlier infringement.
It seemed to reinvigorate the Lions and Lawes powered over from close range only for Gauzere to disallow the score as Biggar was lining up the conversion. Replays reveled the decision to be a correct one as Lawes had fumbled the ball over the line.
The Lions’ fourth try was only delayed for a couple of minutes and it was the pick of the bunch, Tadhg Beirne running a superb line from the 22 to storm in under the posts. He celebrated with gusto and when Biggar converted to make it 28-0 it looked like it might turn into a rout.
But Japan are made of sterner stuff and clawed their way back into the game midway through the second period.
Replacement No 8 Kazuki Himeno scored the try, finding a gap at the back of the lineout and driving his way over the line. Yu Tamura converted but then missed a chance to reduce the leeway further when his penalty attempt drifted wide.
He would have more luck a few minutes later, reducing the Lions’ lead to 28-10 with 12 minutes remaining.
Rory Sutherland had left the field by this point but the prop had acquitted himself well in his first outing since dislocating his shoulder in Scotland’s Six Nations win over France in Paris at the end of March.
The quota of Scots on the field went back up to two with the arrival of scrum-half Ali Price whose introduction as 62nd minute substitute for Murray raised a huge cheer.
Japan had a chance to add a second try late on but their attempt cross-field kick failed to find Matsushima who was in acres of space on the right wing.