Glasgow dominated the first half and their sparkling handling was rewarded with tries from Peter Horne, Jonny Gray and Josh Strauss, with Henry Pyrgos converting two. They came very close to getting a bonus-point try but it proved elusive as Leinster gradually came into game.
Jimmy Gopperth added a penalty to one in the first half from Ian Maddigan for the visitors. Then in a two-minute period Leinster scored tries through Jack McGrath and Tom Denton. With Gopperth converting both, Leinster led 20-19 with four minutes left, but Glasgow's blushes were spared by a penalty from replacement Stuart Hogg well after the 80 minutes had registered.
The game got under way with probably the quickest replacement of the season, in just 42 seconds. The unfortunate man was Leinster centre Noel Reid who went down under a tackle with a leg injury, to be subbed by Ian Madigan.
Glasgow centre Mark Bennett missed a long penalty in the ninth minute but the hosts looked the most adventurous in the early exchanges and this approach brought the opening try in the 17th minute, through stand-off Horne.
The move came following a disrupted Leinster scrum, with Bennett and Pyrgos involved before left winger Tommy Seymour offloaded in the tackle for Horne to score, which Pyrgos then converted.
Gopperth then missed a straightforward penalty for the visitors and soon after dropped a simple pass.
From the scrum, in the 25th minute, Glasgow sparkled before Gray was heaved over from short range with Pyrgos unable to convert.
Six minutes later the third Glasgow try was dotted down, by Strauss who broke a tackle 30 metres out and ran in for Pyrgos to convert.
Madigan got Leinster on the board with a penalty in the 33rd minute but the half ended with Strauss held up on the visitors' line and Pyrgos unable to convert the subsequent penalty.
Despite coming close from the restart Glasgow could not get the bonus-point try and Leinster's first attack of the second half, in the 51st minute, ended with Gopperth kicking a penalty.
Glasgow's backline was disrupted with the loss through injury of both Horne and centre Alex Dunbar, with Hogg and Sean Lamont coming on.
As the 70th minute approached Leinster established themselves around the home 22 and in a two-minute period scored two tries to take the lead.
First, the pack got over from a line-out with McGrath credited. Then another pack replacement Denton got hold of the ball at a line-out and dived over. Gopperth converted both scores.
Glasgow responded by going to the Leinster line where immense pressure was finished off by a penalty kicked by Hogg to win the game.