George Dockrell hit the winning boundary off the penultimate ball to lift Ireland on to 171 for three after they were set a target of 169.
Afghanistan's total of 168 for seven had been boosted by 30 runs off the final two overs, with Ibrahim Zadran clubbing 29 not out off 18 balls.
But Ireland openers Paul Stirling (31 off 29 balls) and skipper Andrew Balbirnie (51 off 38) set their side on their way, putting on 61 off 7.3 overs for the first wicket.
Wicketkeeper Lorcan Tucker kept Ireland on course with 50 off 32 deliveries and it was left to Harry Tector (25 not out) and Dockrell (10 not out) to carry them home.
Earlier, Dockrell took two for seven and Barry McCarthy three for 34 while the Afghans' top-scorer, opener Usman Ghani, struck two sixes and six fours in his 59 off 42 balls.
The two sides will meet again on Thursday at the same Civil Services Cricket Club venue in Stormont for the second time in their five-match series.