Stirling hit a strokeful 88-ball 70 laced with seven fours and two sixes, while Balbirnie anchored the Ireland innings, making a 91-ball 68 as the duo added 81 runs to lay the foundation for the chase after Afghanistan posted 216 for six.
Stirling also shared a 57-run opening stand with Porterfield, while Balbirnie forged a 46-run partnership with KJ O'Brien to take the team home, scoring 219 for five in 47.2 overs.
"All the batters are aware how good their spinners are. I just kind of knew my game, we watched a lot of their footage," said Andy Balbirnie, who was adjudged the man of the series.
Earlier put into bat, Asghar Afghan (82) starred in two valuable partnership -- 76 with Mohammad Nabi (40) and 65 with Rashid Khan (35) -- to help Afghanistan score 216 for six in the stipulated 50 overs.
Afghan's 111-ball innings was studded with six fours and a couple of sixes.
"It was a good series, we are targeting the world cup, so we made changes in every match. Top order's a concern, the Test match should offer an opportunity," Afghan said after the match.
Afghanistan had won the first and fourth ODI, Ireland claimed the third and fifth match, while the second game was washed out.
Ireland were beaten 3-0 by Afghanistan in the T20I series.
The two team will now play a one-off Test starting March 15.
(This story has not been edited by Business Standard staff and is auto-generated from a syndicated feed.)