The visitors lost the opening two matches but raced to 126-3 in 14 overs after bowling out their hosts for 124 in Chittagong.
Shamim Hossain struck his maiden fifty to lift Bangladesh from a precarious 41-5 but it was not enough to deny Ireland their first win of the tour.
“The wicket was good, but unfortunately we lost a few quick wickets,” said Bangladesh’s Taskin Ahmed, who was named Man of the Series.
Stirling hit 10 fours and four sixes, including a six and three fours off consecutive deliveries, to hasten his team’s victory.
Taskin bowled Ross Adair for seven before Shoriful Islam dismissed Lorcan Tucker for four, but Stirling shared a 68-run partnership with Harry Tector for the third wicket to keep Ireland on course.
Ireland were well in control by the time debutant leg-spinner Rishad Hossain had Stirling caught by Najmul Hossain at long on.
Curtis Campher sealed the win with a six off Taskin.
Mark Adair led Ireland’s bowling attack with 3-25, while Matthew Humphreys picked up 2-10, denying Bangladesh the opportunity to build any significant partnerships.
Adair dismissed the in-form Liton Das for five off his first ball in the second over.
“I think taking wickets in the powerplay today made a big difference. It allowed them to have to readjust and with the line-up that they had today,” he said.
Shamim, who came at No 6, hit five fours and two sixes to take Bangladesh past the 100-run mark before he became the last man dismissed.
Bangladesh won the preceding ODI series 2-0.
The two teams will now play a one-off Test starting on Tuesday in Dhaka.
© Agence France-Presse