John Egan volleyed Ireland ahead early on, but Jack Hendry's header levelled.
Both sides spurned big chances before Alan Browne was penalised for handball and Ryan Christie stroked home the penalty winner eight minutes from time.
That puts Steve Clarke's side two points clear of Ukraine, who briefly went top with a 5-0 win in Armenia.
However, Scotland head into their final group game in Krakow, Poland, with more injuries worries after full-backs Kieran Tierney and Aaron Hickey were both forced off, while a late yellow card for Scott McTominay rules the midfielder out through suspension.
Ireland, meanwhile, can now finish no higher than third in the group.
Scotland were buoyed by Wednesday's 3-0 win over Ukraine at Hampden. But with that dominant performance came expectation they would simply roll over an Irish side who three months earlier had handed them a chastening 3-0 defeat.
And a loud and confident Hampden was silenced when Troy Parrott slalomed through the Scotland defence and hammered the ball high into the net. The assistant referee's flag cut short the celebrations, but Ireland were again threatening to spring a shock.
Soon the visitors broke on the counter-attack and got two v two. Hendry blocked Parrott's effort, but it only delayed the opener.
Set-plays had been Scotland's downfall in Dublin and the frailty resurfaced. They struggled to clear a corner, the ball fell to Egan who lashed the ball through a ruck of bodies and past Craig Gordon.
Clarke's men had fallen apart in Dublin, but this time they responded strongly. The ball wouldn't fall for Stuart Armstrong and Lyndon Dykes in the box, while John McGinn mis-hit a shot wide, but the anticipation around Hampden was rising as the home side continued to pour forward.
And four minutes into the second half Scotland were level. Matt Doherty allowed Christie to breeze past him all too easily, and Hendry met his delivery to guide a header into the far corner via the post.
Doherty could have made amends at the other end when Greg Taylor was caught in possession, but he curled wide. Scotland's McGinn thumped past the post too as the game promised another goal.
And that should have arrived when Ireland pulled the hosts apart. From Scotland's corner, Callum McGregor coughed up possession, the Irish broke two on one, Michael Obafemi laid the ball into the path of Parrott who saw the whites of Gordon's eyes but shot straight at him.
Then a Gordon clearance bounced off Chiedozie Ogbene but back into the hands of the grateful goalkeeper. It was all Scotland possession, but Ireland were the ones passing up the chances.
The momentum shifted again in Scotland's favour. Ryan Fraser had a shot tipped over and Doherty defended brilliantly to head the ball away from McTominay.
Just as Scotland's frustration grew as the winner looked to elude them, they were gifted a penalty when the hand of Browne diverted the ball from McTominay's path in the box.
After a video assistant referee check, Christie slotted the penalty down the middle to bring Hampden to its feet. Ireland threw everything at Scotland in an attempt to find an equaliser but found a defence just as desperate to hold on.
It was not the same flowing football from Wednesday, but the 90 minutes was just as pulsating as Scotland made it three straight wins.
Scotland's joy against Ukraine had come from their marauding full-backs and clever movement up front.
Tactically, though, Ireland were smart. Their two strikers pinned Scotland's wide players back, they defended their corners where Scotland had late joy in midweek. And despite Scotland having the lion's share of possession the Irish repeatedly found opportunities of their own.
It was a match that could have gone either way, but a penalty settled it.
Scotland did not have it all their own way as they did on Wednesday, but the confidence will be sky high before their rematch with Ukraine on Tuesday where Nations League promotion and a Euro 2024 play-off place are at stake.
Group B1 concludes on Tuesday, as Scotland take on Ukraine in Krakow, Poland (19:45 BST) and Republic of Ireland host Armenia at the same time.
* Scotland are unbeaten in all eight of their home games in the Nations League (W7 D1) - no team has played more at home without ever losing in the competition (Italy also 8).
* Republic of Ireland are winless in all seven of their away games in the competition (D2 L5), losing each of the last four.
* Both teams scored with their first shots on target - for Scotland it was just the second time they'd conceded first in a home game in the Nations League (also v Israel in 2018), while it was the first time Ireland had scored first in an away game in the competition.
* In his 33rd appearance for Scotland, Ryan Christie both scored and assisted a goal in the same game for the first time at international level.
* Jack Hendry completed all 60 of his passes - the most a player has made while maintaining a 100% pass accuracy in this edition of the Nations League.
* John McGinn has created more chances (12) and had more shots (19) than any other Scotland player at this edition of the Nations League, with the midfielder having a further three of each against Ireland.