The first half was one to forget, with Slovakia edging it both on chances and possession. However, they were lacking an out-and-out goal scorer and couldn't make their dominance count. They got stronger as the half wore on, but a Marek Hamsik long-range effort over the bar two minutes before half-time perhaps typified the quality of the game.
Meanwhile, Sweden were playing to their defensive strengths, with a point for both sides being seen as a decent result.
The second half was a marked improvement, albeit from such a poor base, with Ludwig Augustinsson forcing an excellent save from Slovakia keeper Martin Dubravka, who tipped his effort over the bar on the hour mark. Two minutes later, Alexander Isak's long-range shot was deflected wide.
Isak was again in the thick of the action in the 72nd minute, almost scoring a sensational solo goal when darting down the left. He left defenders in his wake, included a few stepovers for good measure, cut inside and launched a rasping shot that Dubravka got down well to save.
Isak was running the show by this point and was instrumental in Sweden being awarded a penalty in the 77th minute. He tapped the ball to Robin Quaison, who was brought down by Dubravka. Forsberg stepped up to take the spot kick and buried it past the Slovak keeper, who dived the right way but couldn't deal with the pace of the ball.
Slovakia pushed for an equaliser in the closing stages of the game and nearly got one three minutes from time, when the ball pinged around the box from a corner. However, the Swedes escaped.
The win takes Sweden to the top of Group E with four points, although this may change when Poland take on Spain on Saturday.
Stat of the day
From OptaJoe: Emil Forsberg's penalty ended a run of 365 minutes without a goal for Sweden at the European Championships. This was their first goal at the Euros since their opening group game in 2016 against the Republic of Ireland.
What's next for Sweden and Slovakia?
The final games of Group E take place at 17:00 BST on Wednesday, June 23.
Sweden will stay in St Petersburg and face Poland at the Krestovsky Stadium while Slovakia will travel to Seville to play Spain in La Cartuja.