Swansea looked bright in the early stages of the contest but it was St Gallen who had the chance to take the lead when Dwight Tiendalli was punished for handling the ball inside the box.
The visitors had another opportunity to break the deadlock just moments later but Marco Mathys fired an effort wide after sprinting away from a couple of Swansea defenders.
© Getty Images
A long pass over the top of the Swansea defence almost brought an equaliser for St Gallen but substitute Alhassae Keita lobbed his volley over the crossbar after controlling the ball with confidence.
Nathan Dyer's introduction injected more pace into the home side's attacks and the winger threatened to double his team's lead when he volleyed straight at Lopar.
Swansea were put under pressure in the closing stages, with Stephane Nater striking the post from long range but the hosts held firm to secure the win.