England, outclassed in the first four games, opted to bat in the final game and made 321 for seven, the first time any side has scored more than 300 in a One-day International at Headingley.
The left-handed opener scored 120 off 118 balls but was lucky not to be given out on 36 when he appeared to snick an inside edge behind off pace bowler Dilhara Fernando.
The Sri Lankans pointedly refused to clap when he reached three figures.
Trescothick punished anything wide outside off stump while also chipping cleverly over the leg-side infield. He hit 16 fours and one six, lofted over wide mid-on off leg-spinner Malinga Bandara.
His century was England's first in the series, while their opponents have recorded one in each of the previous four games.
Strike bowler Lasith Malinga, who returned with a fine spell at the death, took four for 44.
The game had begun with an excellent spell of swing bowling from left-armer Chaminda Vaas, who found a perfect length and line as he shaped the ball away from the left-handers. England had managed to scrape only three runs together with one ball left in the fifth over.
Trescothick, having faced 18 balls without scoring, then drove Vaas's first bad ball square for four and England were underway. They had scored 39 off the first 10 overs but were up to 73 off 15.
While Alastair Cook never looked at his most fluent, Trescothick was hitting boundaries in clutches. Fernando was one of the chief sufferers, his first four overs going for 31.
Cook made 41 out of a total of 82 before slapping a cross-bat shot off medium-paced Farveez Maharoof straight to extra cover.
Trescothick and Ian Bell reached their half-century partnership off 42 balls, Bell contributing just 11.
He added seven more before attempting to glide Fernando to third man. The excellent Kumar Sangakkara dived right and claimed a fine one-handed catch.
That 75-run stand was followed by 68 for the third wicket, Andrew Strauss again letting Trescothick dictate the pace before the England captain edged Lasith Malinga behind. He made 26.
On 225 for three in the 38th over, England would have hoped for Trescothick to stay around for the final assault but he followed one over and eight runs later when he aimed to dab Sanath Jayasuriya's left-arm spin to third man and was bowled.
Vikram Solanki (44 not out off 34 balls) and Jamie Dalrymple (30 off 27) built on Trescothick's good work, putting on 62 in just under eight overs as Sri Lanka's fielders struggled to live up to their high standards.
The last 10 overs cost 81 runs, with Bandara's seven overs going for 50.
The flags at Headingley were flown at half-mast on Saturday following the death of Yorkshire and England fast bowler Fred Trueman.