Substitute Gastón Pereiro set up one goal and scored a stoppage-time winner as relegation-threatened Cagliari again came from behind to beat Bologna 2-1 in Serie A on Tuesday.

Leonardo Pavoletti had canceled out Riccardo Orsolini’s second-half opener for Bologna. Both sides also hit the woodwork.

It was the second match in succession that Cagliari had come from a goal down to win 2-1, having done the same at Sampdoria last week.

Bologna's Marko Arnautovic and Cagliari's Giorgio Altare, right, battle for the ball during the Serie A soccer match between Cagliari Calcio and Bologna FC at the Unipol Domus stadium in Cagliari, Italy, Tuesday Jan. 11, 2022. (Alessandro ToccoLaPresse via AP)

Bologna's Marko Arnautovic and Cagliari's Giorgio Altare, right, battle for the ball during the Serie A soccer match between Cagliari Calcio and Bologna FC at the Unipol Domus stadium in Cagliari, Italy, Tuesday Jan. 11, 2022. (Alessandro ToccoLaPresse via AP)

Cagliari moved to within a point of safety, although it has played a match more than 17th-placed Venezia. Bologna remained 12th.

Both sides had different aims and it was an energetic match from the start in Sardinia. The home side almost took the lead in the 14th minute but Raoul Bellanova’s angled effort came off the base of the right post.

Bologna took the lead early in the second half when Orsolini curled a free kick into the top near corner.

But Cagliari leveled in the 71st. A throw-in was only half cleared and Pereiro crossed it back in for Pavoletti to volley in the equalizer.

Bologna almost immediately restored its lead but home goalkeeper Alessio Cragno did well to push Orsolini’s effort off the left post and out.

Instead it was Cagliari that scored the winner in the fourth minute of stoppage time when Pereiro ran onto a through-ball from João Pedro and fired into the bottom near corner.

More AP sports: https://apnews.com/hub/apf-sports and https://twitter.com/AP_Sports