Sri Lanka, following on, were dismissed for 119 in their second innings as England went 1-0 up in the three-match series.
Anderson finished with match figures of 10 for 45.
England, who lost the toss, made 298 in a first innings featuring Jonathan Bairstow’s 140 on his Yorkshire home ground and a Test-best 86 from opener Alex Hales.
Sri Lanka in reply were shot out for 91, with Anderson taking five for 16 and Stuart Broad four for 21 in an innings that was wrapped up inside 37 overs.
England captain Alastair Cook enforced the follow-on and Sri Lanka promptly collapsed again, with only Kusal Mendis (53) offering much resistance.
Sri Lanka, 116 for seven at tea on Saturday, lost their last three wickets in nine balls after the break, with Anderson ending the match when be bowled last man Nuwan Pradeep.
The series continues with the second Test at Chester-le-Street starting on Friday.
England 1st Innings 298 (J Bairstow 140, A Hales 86; D Shanaka 3-46, D Chameera 3-64)
Sri Lanka 1st Innings 91 (J Anderson 5-16, S Broad 4-21)
Sri Lanka 2nd Innings 119 (K Mendis 53; J Anderson 5-29, S Finn 3-26)
Result: England won by an innings and 88 runs
Series: England lead three-match series 1-0