The 33-year-old produced an unbeaten 80 from just 51 balls as the Aussies clinched a rain-affected two-wicket win with nine balls to spare.
Australia were initially chasing a total of 300, but that target was reduced to 282 from 42 overs following an hour of rain in Pallekele.
The tourists repeatedly put themselves in the driving seat, as spin bowler Wanindu Hasaranga continued to cause frustrations by taking four wickets for 58.
Australia looked in a solid position at 126/2, 189/4 and 228/5, but a worrisome feeling began to grow around their team as Hasaranga removed both Alex Carey and Pat Cummings in a matter of just three deliveries.
The visitors needed someone to steady the waters and Maxwell, who was competing in his first ODI in more than 18 months, stepped up to the plate.
The player produced six sixes during his 51-ball spell at the crease, knocking off powerful shots through the leg-side whenever the Sri Lankan attack produced a bowling error.
While Ashton Agar did become Australia's eighth victim with 28 runs still needed, Maxwell showed his cool as he finished the job with back-to-back sixes in the penultimate over.
Earlier in the innings, Marcus Stoinis and Aaron Finch both helped to build a solid platform with scores of 44, while Steve Smith sealed a half-century with his 53.
Despite the victory, there are further injury worries for the tourists as Agar reported pain in his side following the end of his 10 overs.
Australia are already without Mitchell Starc and Mitchell Marsh for the second ODI, while Sean Abbott and Kane Richardson have both returned home due to injuries.
Another major question mark remains over the team's bowling attack, which struggled to get much out of the slow pitch.
Considering next year's one-day World Cup will be contested on similarly slow Indian wickets, Australia need to find a solution if they are to be serious title contenders.