Harbhajan came to India's rescue with a couple of early wickets after the opening bowlers were carted around the park. He finished with remarkable figures of five for 56, as Sri Lanka were dismissed for 273 in 46.4 overs, enabling India win by 46 runs.
After Saturday's debacle against the hosts, India needed a strong showing with the bat and Tendulkar led the way with a masterly innings of 138 that saw India post a mammoth 319 for five in their 50 overs after electing to bat.
The veteran batsman, who stroked 10 boundaries and a six in his 133-ball knock, gave India a rousing start in a 95-run opening stand with Rahul Dravid (39). He then made sure India consolidated in a 110-run partnership in 115 deliveries for the second wicket with Mahendra Singh Dhoni, who hit 56 from 62 deliveries.
Yuvraj Singh provided the finishing touches to the batting with a blazing 56 from 41 deliveries, leaving Sri Lanka to chase a record total to win.
India:
Interestingly, India sent in their two most experienced batsmen to open the innings -- Rahul Dravid (336 ODIs) and Sachin Tendulkar (428 ODIs) -- with the obvious intent of giving them more overs to settle and play big knocks.
Dravid started confidently with a cracking boundary through point off the second ball of the innings. Tendulkar struck his first boundary a few overs later when he creamed a slower delivery from Nuwan Kulasekara through the covers to take India to 19 for no loss after five overs.
The master batsman struck another two boundaries in Kulasekara's next over, on either side of the wicket, to race to 22 from 19 deliveries. Another couple of boundaries followed in the next over from Thilan Thushara as the two veterans brought up their 50-run partnership in 57 deliveries.
Dravid, on 24 from 34 deliveries, enjoyed a huge slice of luck when his uppish-cut shot was floored by Tillakaratne Dilshan at the point region in the 12th over.
The first 15 overs went according to script for the Indians as they reached 76 no loss. The two senior batsmen realised the need for rotating the strike and scored 22 singles, six twos to go along with eight boundaries while conceding only 51 dot balls.
Tendulkar raced to his half-century, his 92nd in ODIs off just 47 deliveries, in the 16th over. It was his sixth half-century at the R Premadasa stadium, where he has now scored more than 1000 runs in 27 matches.
Dravid slammed the first six of the match when he picked up the googly from Ajantha Mendis and lofted it straight down the ground in the 17th over.
Just when he was starting to look good, Dravid threw his wicket away with a soft shot. The right-hander chipped left-armer Sanath Jayasuriya straight to Dilshan at cover and was out after a solid knock of 39 from 56 deliveries, inclusive of two boundaries and a six. (95-1, 17.2)
However, the stand-in opener had done his job to perfection, adding 95 runs in 104 deliveries for the opening wicket with Tendulkar that laid a solid platform for the middle order.
India then made another change in their batting order, Mahendra Singh Dhoni promoting himself to number three. The skipper dealt mainly in singles and doubles from the start, with some quick running between the wickets, to race to 38 from 42 deliveries, while Tendulkar coasted to 93 from 83 deliveries as India reached a comfortable 173 for one after 30 overs.
It was all smooth going for Tendulkar in the nineties and he duly promptly completed his 44th century in ODIs with a single on the off-side in the 33rd over, bowled by Mendis. He took just 92 deliveries to reach the landmark, hitting eight boundaries. It was his eighth century against Sri Lanka and fourth at the venue.
India sensibly took the Batting Powerplay after the 34th over, bowled by Malinga, and Dhoni started it with a couple of boundaries. It brought up the Indian captain's half-century in just 54 deliveries and also raised the 100-run partnership in 104 deliveries for the second wicket between Dhoni and Tendulkar.
Dhoni made a brisk 56 from 62 deliveries, inclusive of three boundaries, before he was caught at square leg off Malinga while attempting a pull shot. But before being dismissed he played his role to perfection, adding 110 runs in 115 deliveries for the second wicket, relying mostly on singles and doubles, with Tendulkar. (205-2, 36.3)
India could not fully utilise the batting Powerplay, partly because of Dhoni's dismissal and Tendulkar's exhaustion, and they scored just 33 runs from the five overs.
Yuvraj Singh struggled to get going at the start of his innings before he unleashed a huge six over wide long-on in the 42nd over by Thushara.
Tendulkar, who employed Dravid as his runner, struggled in the latter part of the innings due to cramps and exhaustion. He then started to hit out, carting Mendis for a huge six over the covers in the 46th over, and followed it up with two boundaries by using the reverse sweep.
But Mendis had his revenge off the last delivery when he trapped Tendulkar leg before wicket, the batsman attempting another reverse sweep. The veteran scored a magnificent 138 from just 133 deliveries, hitting 10 boundaries and a six, having batted for most of India's innings. (276-3, 46)
Yuvraj provided the necessary impetus for India with a string of boundaries in the final few overs. He completed his half-century in the final over off just 39 deliveries and finished unbeaten on 56 from 51 deliveries, inclusive of six boundaries and a six, to help India post a mammoth 319 for five in their 50 overs.
India smashed 58 runs from the last five overs despite losing three wickets, as all the Lankan bowlers suffered. Thushara was Sri Lanka's most successful bowler, claiming two for 71 in his 10 overs, while Malinga suffered the most, finishing with one for 81 in his 10 overs. Mendis went for 70 in his 10 overs. A total of 18 wides and a no-ball helped India's cause.
Sri Lanka, however, will not be utterly disappointed and fancy their chances of chasing down the runs on a pitch still good for batting.
Sri Lanka:
Tillakaratne Dilshan took the attack to the bowlers right from the word go, thumping Ishant Sharma for four boundaries through the off-side in the pacer's first two overs.
The Indian ground fielding and catching was once again a big letdown. Sanath Jayasuriya, on 13 from 16, cut one straight to Virat Kohli but he grassed the simple offering off RP Singh. And to rub salt on RP Singh's wound, Jayasuriya followed that dropped catch with consecutive boundaries.
Dilshan then smashed Nehra for three more boundaries in the seventh over, which included his trademark scoop over the wicketkeeper, as Sri Lanka raced to 60 for no loss after seven overs.
Dhoni was forced to introduce Harbhajan Singh early into the attack and his most senior bowler responded to his captain's call of duty with wickets in his first two overs.
Dilshan tried to cut the off-spinner through the off-side, having hit the previous ball for a boundary, but this time the ball was a bit quicker and ended up crashing into his stumps.
However, Dilshan had provided Sri Lanka the perfect start as he smashed 42 from 29 deliveries, inclusive of nine boundaries, adding 64 runs for the first wicket in 47 deliveries. (64-1, 7.5)
Harbhajan then bagged another important wicket in his next over when he deceived Mahela Jayawardene with the doosra and had him caught and bowled for 1. (76-2, 9.4)
Jayasuriya didn't let India take the initiative despite those two wickets, as he continued attacking. Once again Dhoni did the trick with an inspired bowling change as Yusuf Pathan claimed the wicket of Jayasuriya in his first over. The veteran left-hander top edged Pathan as he tried to play one on the leg side and was taken by Nehra at mid-on for 36 from 29 deliveries, inclusive of seven boundaries. (85-3, 11)
The introduction of spinners had helped India wage a fightback after Sri Lanka's blazing start; the hosts lost three wickets for 21 runs in the space of 19 deliveries.
Thilan Thushara was sent in as pinch-hitter and he smashed 15 from 13 boundaries, inclusive of three boundaries, before being bowled by Ishant. (108-4, 14.3)
New batsman Angelo Mathews was in no mood to hang around and started with a huge straight six off Ishant to help Sri Lanka reach 114 for four after 15 overs.
However, once again Dhoni's bowling change worked wonders, as Yuvraj struck in his very first over with the wicket of Mathews. The right-hander threatened briefly with 14 from 11 deliveries, before chipping one straight to Raina in the cover region. (131-5, 17.3)
Sangakkara, on 28, got a reprieve when his counterpart, Dhoni, missed an easy stumping after the left-hander was beaten by Raina's off-spin in 25th over.
The batsman didn't make full use of that missed opportunity and fell for 33, dismissed hit-wicket off RP Singh. The Sri Lanka captain looked like steadily taking his team towards India's total after adding 51 runs in 60 overs for the sixth wicket with Thilina Kandamby before the bat slipped out of his sweaty gloves and ended up on the stumps. (182-6, 27.3)
India made another huge blunder in the field when Yusuf Pathan dropped another simple catch. Kandamby, on 37, top-edged the attempted slog sweep but Pathan in the cover region could not hold on and, expectedly, Yuvraj was furious.
The left-hander enjoyed another run-out chance when Dhoni missed the stumps, and three balls later he brought up his half-century off 70 deliveries, inclusive of four boundaries.
Chamara Kapugedera also blossomed in confidence with time at the wicket and he slammed Nehra for consecutive boundaries in the 39th over. With ten overs to go, the match was tantalizingly poised, with Sri Lanka needing 80 from 60 deliveries, but they only had four wickets in hand.
Raina's golden arm then worked wonders as he struck with the key wicket of Kapugedera, who was caught behind for 35 from 42 deliveries. (252-7, 42.3)
Sri Lanka seemed to have suddenly hit a roadblock, with just 18 runs coming from four overs, and India held the upperhand as 66 were required from the last seven overs.
Harbhajan then sealed the contest in India's favour with consecutive wickets in the 45th over.
Kandamby gave himself room and tried to play the cut shot through point but missed completely and was bowled for a good knock of 66 from 94 deliveries. (264-8, 44.3)
Lasith Malinga was deceived by the doosra and his leading edge went straight back to Harbhajan, who accepted it with delight. (264-9, 44.4)
The off-spinner then completed his five-wicket haul when Mendis was stumped for 7 in the 47th over. Sri Lanka were bowled out for 273 in 46.4 overs and lost by 46 runs.
Harbhajan ended with superb match-winning figures of five for 56 in 9.4 overs to help India win the Compaq Cup tri-series. Raina's contribution was quite important too as he took one for 26 in eight overs while Yuvraj took one for 24 in six overs to help Dhoni's cause after the seamers were taken apart by the Lankan batsmen.
Dhoni's captaincy also needs special mention; his timely bowling changes made all the difference. He showed great composure despite Sri Lanka getting off to a blazing start. Every time he got a bowler into the attack in the middle overs it fetched him a wicket.
This tournament should provide a big boost to the Indian team going into the ICC Champions Trophy. But they still have a lot of work to do as far as their fielding is concerned and the opening bowlers also need to get their length sorted out.
India take over number one ranking in ODIs
Video: Did Harbhajan really punch the cameraman?
Sri Lanka call up Fernando for one-day series
US funds used to strengthen against India: Mush
Virat Kohli to replace injured Gambhir in Lanka