After being humiliated in Melbourne losing the Boxing Day Test by an innings and 201 runs, Sri Lanka hit back hard in Sydney chasing a first Test victory in Australia and to avoid a 3-0 whitewash in the series.
Coming into the fourth day, the tourists were 7-225 with a lead of just 87 runs, but an outstanding 62 not out from 23-year-old wicket-keeper batsman Dinesh Chandimal and some solid support from the bowlers saw Sri Lanka reach 278 and set Australia a challenging 141 for victory.
It became even more of a challenge when David Warner was out first ball, caught Mahela Jayawardene off Suranga Lakmal, but then Ed Cowan and Phil Hughes survived, only just, to lunch with Australia 1-13 and needing a further 128 runs to win.
Off-spinner Tillakaratne Dilshan continued on after the luncheon interval and then once left-arm orthodox maestro Rangana Herath came on from the other end, the going got extremely tough for Hughes and Cowan.
The left-handers were hanging in there, though, despite a bevy of appeals – some close LBW calls and some not so – but they did appear to be starting to steady things taking the score to 1-45.
Herath continued to press hard, though, showing why he was Test cricket's leading wicket-taker in 2012. He had a big shout against Hughes for both LBW and caught at bat-pad, and the review showed that the delivery was cannoning into Hughes' leg stump.
That saw him depart for 34 with Australia 2-45 and still needing 96.
The SCG crowd was desperately hoping the retiring Hussey was next to bat, but captain Michael Clarke strode to the wicket instead and he looked the most assured batsman against the spinners as he used his feet to nullify their danger.
Clarke and Cowan did well to put on a 59-run partnership and take the score to 2-104 before Clarke hit a bat-pad catch to Lahiru Thirimanne off Dilshan.
The skipper walked taking the decision out of the umpire's hands after he made 29 leaving Australia 3-104 with Hussey striding to the wicket to a standing ovation from the SCG crowd.
The 37-year-old was a bundle of energy at the crease immediately, but he soon saw his partner depart when Cowan was out for 36. Herath trapped him plumb in front and even though Cowan took his chances with a review, the ball was going straight to the middle of middle stump.
That brought an end to the opener's knock of 36 with Australia 4-108 and needing 33 to win still, but with Hussey's assuredness at the crease things always looked in hand.
Matthew Wade did fall for eight, bowled by Herath, with nine runs needed, but Hussey had things in control and even though Mitchell Johnson hit the winning run, it was Hussey's day to celebrate being at the crease with the victory brought up in the final match of his 79-Test career.
He finished 27 not out taking him to 6235 Test runs at an average of 51.52 with 19 centuries and 29 half-centuries. He has also played 185 one-day internationals and 38 Twenty20 matches for Australia, but could be finished in all formats for his country after being left out of the one-day squad to face Sri Lanka.
The match also brought to an end the time as captain of Sri Lanka's Jayawardene. The 35-year-old did all he could in Sydney with knocks of 72 and 60 to try to press for a first victory in Australia in what is sure to be his final Test in the country, but it wasn’t to be.
Along the way, he took another catch to give him 194 in his Test career. When combined with his 194 in his 386 one-day international appearances, Jayawardene's 388 catches is the most of any player in history.
It was a good fighting effort from Sri Lanka with Herath the star with the ball on the final day finishing with 3-46 from 16.5 overs. Dilshan and Lakmal picked up a wicket each.
Jackson Bird was named man-of-the-match for his 4-41 in Sri Lanka's first innings and 3-76 in the second, as well as his handy knock with the bat to help Wade to his century.
Australian captain Clarke was named player of the series after making 316 runs at 63.2 with a highest score of 106.