Andy Farrell's side had defeated Wales, France and Italy in the opening three rounds and was a point better off than Scotland at the end of a gripping first half in Edinburgh.
Mack Hansen cancelled out Huw Jones' try to help give the visitor a slender advantage, which James Lowe added to shortly before the hour in a crucial moment in the match.
Jack Conan gave Ireland breathing space soon after to ensure it sits four points clear of France before hosting England in the final round of fixtures.
The Grand Slam dream is alive! ☘️@IrishRugby win a thunderous Test match in Edinburgh to take a step closer to the title.#AwakenAnticipation | #SCOvIRE pic.twitter.com/mnYgW6lgw5— Guinness Six Nations (@SixNationsRugby) March 12, 2023
Iain Henderson grounded early on for Ireland, only for the officials to rule out the try on a technicality as the line-out that Caelan Doris intercepted was taken with a different ball.
Ireland dominated but only had Johnny Sexton's penalty to show for it and it was Scotland that opened the try count when Sione Tuipulotu played in Jones to dive over.
Finn Russell added the extras but Ireland responded 10 minutes later through Hansen, who raced in down the right to ground despite Duhan van der Merwe's best efforts.
Hugo Keenan's fine challenge stopped Van der Merwe from racing through but Ireland's problems mounted when Ronan Kelleher – a replacement for Dan Sheehan – limped off.
It remained a one-point contest until, after a few near-misses, Ireland worked the ball to the left and Lowe dotted down with 56 minutes played.
Conan showed good pace and power to score a third Irish try after good work from Hansen, with Sexton making it two successful conversions out of three.
That drew Sexton level with Ronan O'Gara for the most Six Nations points scored.
He he did not have any further opportunities to edge in front as Ireland missed out on a bonus point.