Switzerland booked their spot in the last 16 of the World Cup courtesy of a 2-2 draw with Costa Rica in Nizhny Novgorod on Thursday morning (AEST).

Brazil's win over Serbia in the night's other Group E game means that Vladimir Petkovic's side finish second in the pool and will take on Sweden in St Petersburg on Tuesday.

Switzerland - whose last-gasp win over Serbia in their second game set them up for progression to the knockout stages - were second best for large periods against their already eliminated opponents, but did take the lead just after the half-hour mark.

Blerim Dzemaili took advantage of generous marking to power home from close range before Kendall Waston pulled Costa Rica level shortly after the interval.

Substitute Josip Drmic thought he had secured all three points for Switzerland with a cool 88th-minute finish before Bryan Ruiz's penalty cannoned off Yann Sommer for an unfortunate own goal to ensure a share of the spoils.

Switzerland's attentions now turn to their crunch clash with Janne Andersson's side, while Costa Rica are left to reflect on a campaign that fell well short of their magical run to the quarter-finals in 2014.