St Johnstone are facing an early Europa League exit at the third qualifying round stage after they were beaten 2-1 by Spartak Trnava at McDiarmid Park.