Scotland are through to a unlikely World Cup quarter-final against holders New Zealand after Tonga ended Italy's fairytale run with a 16-0 defeat in Halifax.
Although the Scots ended their group campaign with five points out of a possible six, their fate hung in the balance until after Sunday's clash at The Shay.
Scotland coach Steve McCormack and his squad watched the action on television from their Manchester hotel knowing an Italian victory would put his undefeated team out of the competition and the tension must have been unbearable after a try-less first half, which closed with Tonga just 2-0 in front.
However, the Tongans came to the Bravehearts' rescue, roared on by the 10,266 crowd, as charging runs by Fuifui Moimoi lifted his side.
Instead of going through to the last eight, Italy finish bottom of Group C after suffering their first defeat.
Scotland, who will have been relieved to see Italy have two tries disallowed, will now go back into training to prepare for Friday's clash with the Kiwis at Headingley.
The Pacific Islanders had the better of the first half but Italy's defence, superbly marshalled by skipper Anthony Minichiello, held firm and Tonga's hard-running threequarters Mahe Fonua and Jorge Taufua were both bundled into touch just short of the corner.
The only points of the first half came a minute before the break when Italy were caught offside in front of their posts and stand-off Samsoni Langi opted to go for goal.
Italy thought they had scored again within a minute of the re-start when they shifted the ball to the right to get centre James Tedesco into space and he sped away to the line.
However, for the second time video referee Phil Bentham ruled the Italian player had been unable to ground the ball and Tonga made the most of the let-off.
A barnstorming run from Moimoi got his side into a great attacking position and Willie Manu took Langi's short pass to crash through the Italian defence for a try.
Langi's conversion made it 8-0 but the Azzurri came back stronger than ever.
The Tongan defence was subjected to relentless pressure but impressive full-back Nesiasi Mataitonga launched a counter-attack to set up the position for Foster to force his way over for a solo try, although he appeared to put the ball down on a defender's leg.
If there was any controversy over the score, it was quickly forgotten as Foster carved out a third try for substitute Peni Terepo to wrap up the win.
Tonga 16 (Foster, Manu, Terepo tries; Langi 2 goals)
def.
Italy 0
Click here to see all the latest news, photos and videos from the Rugby League World Cup!
Although the Scots ended their group campaign with five points out of a possible six, their fate hung in the balance until after Sunday's clash at The Shay.
Scotland coach Steve McCormack and his squad watched the action on television from their Manchester hotel knowing an Italian victory would put his undefeated team out of the competition and the tension must have been unbearable after a try-less first half, which closed with Tonga just 2-0 in front.
However, the Tongans came to the Bravehearts' rescue, roared on by the 10,266 crowd, as charging runs by Fuifui Moimoi lifted his side.
Instead of going through to the last eight, Italy finish bottom of Group C after suffering their first defeat.
Scotland, who will have been relieved to see Italy have two tries disallowed, will now go back into training to prepare for Friday's clash with the Kiwis at Headingley.
The Pacific Islanders had the better of the first half but Italy's defence, superbly marshalled by skipper Anthony Minichiello, held firm and Tonga's hard-running threequarters Mahe Fonua and Jorge Taufua were both bundled into touch just short of the corner.
The only points of the first half came a minute before the break when Italy were caught offside in front of their posts and stand-off Samsoni Langi opted to go for goal.
Italy thought they had scored again within a minute of the re-start when they shifted the ball to the right to get centre James Tedesco into space and he sped away to the line.
However, for the second time video referee Phil Bentham ruled the Italian player had been unable to ground the ball and Tonga made the most of the let-off.
A barnstorming run from Moimoi got his side into a great attacking position and Willie Manu took Langi's short pass to crash through the Italian defence for a try.
Langi's conversion made it 8-0 but the Azzurri came back stronger than ever.
The Tongan defence was subjected to relentless pressure but impressive full-back Nesiasi Mataitonga launched a counter-attack to set up the position for Foster to force his way over for a solo try, although he appeared to put the ball down on a defender's leg.
If there was any controversy over the score, it was quickly forgotten as Foster carved out a third try for substitute Peni Terepo to wrap up the win.
Tonga 16 (Foster, Manu, Terepo tries; Langi 2 goals)
def.
Italy 0
Click here to see all the latest news, photos and videos from the Rugby League World Cup!