|Ireland: (7) 28|
|Tries: Henry, Cronin, Zebo, Fitzgerald Cons: Madigan 4|
|Scotland (7) 22|
|Tries: Cowan, Pyrgos, Horne Pens: Horne Cons: Horne, Jackson|
Ireland were made to battle before holding off Scotland's impressive experimental line-up in Dublin.
Chris Henry's try put the hosts 7-0 up early on but a Blair Cowan touchdown saw Scotland get level by the break.
Henry Prygos and Peter Horne added tries as Scotland led three times in the second half with Sean Cronin scoring a second Irish touchdown.
However, late tries from Simon Zebo and Luke Fitzgerald saw the Irish snatch a somewhat fortunate victory.
Scotland coach Vern Cotter will probably take more positives from this World Cup warm-up match, with his side producing some impressive running rugby.
In contrast, Joe Schmidt is unlikely to have been impressed with the rather lacklustre nature of much of his team's display, with handling errors and a lack of physicality hindering their efforts.
Veteran centre Gordon D'Arcy's quiet match at the heart of Ireland's midfield could leave the 35-year-old struggling for final World Cup selection, but Ulster flanker Henry has probably now done enough to nail down his place.
Scotland coach Cotter will be concerned about an injury sustained by prop Ryan Grant.
The 29-year-old Glasgow man damaged his right ankle just minutes into the second half and must be considered a major doubt for the World Cup.
Determined to experiment, Ireland declined four eminently kickable penalties, which allowed the Scots to be level at the interval.
The Irish did score their opening try from one of the kicks to the corner, though, with Henry being pushed over by team-mate David Kilcoyne in the 15th minute.
Cowan popped over in Scotland's sole attack late in the half, the Kiwi-born flanker owing his score to the impressive David Denton barrelling over Mike Ross and Ruaridh Jackson delivering a cute pass to Richie Vernon.
Scotland skipper Pyrgos punished sloppy Irish defending as he squeezed between Mike Ross and Irish debutant Jack Conan to give the visitors a five-point lead early in the second half.
Ireland responded with fly-half Ian Madigan kicking another penalty to the corner. From a strong line-out drive, hooker Cronin drove over for his second international try to make it 12-12.
Leinster man Madigan slotted the conversion to wrestle back the lead, with regular captain Paul O'Connell coming off the bench to raise the impetus again.
Horne's first penalty of the day put Scotland back into a 15-14 lead but that only lasted one minute as replacement Dave Kearney's run helped set up Zebo's try.
Madigan was also involved in the move and he produced two slick passes either side of his own feint outside as Zebo ran in on an angled line, with the fly-half adding the conversion.
The lead changed hands again when Horne raced home after a poor clearance kick from Fitzgerald and Ruaridh Jackson's conversion edged Scotland ahead 22-21.
But Ireland responded once again, Madigan delivering an inch-perfect crossfield kick into Fitzgerald's onrushing grasp and the Leinster wing nipped home for the hosts' fourth and final try.
Ireland: Zebo, Bowe, Payne, D'Arcy, Fitzgerald, Madigan, Boss, Kilcoyne, Cronin, Ross, Toner, Tuohy, Conan, Henry, O'Brien.
Replacements: Strauss for Cronin 59, White for Ross 51, O'Connell for Tuohy 55, Murphy for Conan 65, Reddan for Boss 65, Jackson for Zebo 77, D Kearney for Bowe 59.
Scotland: Jackson, Lamont, Vernon, Horne, Visser, Tonks, Pyrgos, Grant, Brown, Welsh, Hamilton, Gilchrist, Cowan, Blake, Denton.
Replacements: Ford for Brown 51, Reid for Grant 45, Cusack for Welsh 46, Harley for Hamilton 55, Barclay for Cowan 57, Hidalgo-Clyne for Pyrgos 65, Scott for Vernon 61.
Not used: Weir
Referee: Pascal Gauzere (France)