KIEV, Ukraine — Theo Walcott came on as a substitute to score one goal and set up another Friday in a come-from-behind 3-2 win over Sweden at the European Championship.

The result eliminated Sweden and leaves England needing only a draw in its final Group D match against co-host Ukraine to ensure a spot in the quarterfinals. For that match, England striker Wayne Rooney will be back from suspension.

England had wasted a halftime lead and fell behind 2-1 as Sweden desperately pushed for a victory, but Walcott came on in the 61st minute and made it 2-2 in the 64th. He then set up Danny Welbeck for the winner in the 78th.

Walcott broke into the area and picked out Welbeck, who flicked a backheel past a diving Andreas Isaksson to give England its first win over Sweden in a competitive game in eight tries.

“When we went behind, we still had the belief. We stuck together and the team spirit has shone through,” Welbeck said. “We all know the ability Theo has got and that’s the same right across the squad, so whoever comes on the pitch is going to make a difference. I’m very happy for Theo.”

The result, following a 1-1 draw with France, may silence some of the critics who thought the team has become too defensive under coach Roy Hodgson as it proved that it can score goals when it needs to.

“We felt, from the first game, that we wanted to pick it up a bit more offensively,” Walcott said. “And if you score three goals that’s the main thing.”

Sweden, for its part, let a second-half lead slip away for the second game in a row after falling 2-1 to Ukraine in its opener. While the Swedes put in a much-improved performance on Friday, they once again failed to shut their opponents down defensively.

In a game that featured plenty of chances for both sides, Andy Carroll had given England the halftime lead with a powerful header in the 23rd minute that showed exactly why Hodgson elected to start the tall Liverpool forward up front. Carroll got between two defenders to meet Steven Gerrard’s cross in the area as Sweden was once again exposed in the air.

But Sweden fought back through an unlikely source in Mellberg, whose shot past Joe Hart was pushed into the net by Glen Johnson.

Walcott then started the English comeback when a corner was headed out to the Arsenal winger outside the area and his shot somehow fooled Isaksson, who was falling the wrong way and flailing as he watched the ball fly into the middle of the net.