Despite a narrow defeat Linfield produced a battling performance in Slovakia to keep their Europa League hopes very much alive.
Spartak almost got off to a perfect start when Bosnian international Haris Harba struck the woodwork inside the opening minute.
Linfield created an early chance themselves moments later when Aaron Burns sent an effort narrowly wide.
However Spartak moved in front on 16 minutes through Erik Sabo with a successfully converted spot-kick following a Ross Glendinning foul on Martin Mikovič.
Linfield levelled five minutes later through David Kee after he knocked home a superbly executed free-kick from the edge of the area.
Back came Spartak ten minutes from the break to regain the advantage when Mikovič knocked the ball home from close range.
Spartak were reduced to ten men a minute from half-time after Miloš Nikolič collected his second caution following a challenge on Ivan Sproule.
Linfield looked to make their numerical advantage count after the break and, indeed, enjoyed considerable possession coming close just after the hour when Ross Clarke had a goalbound shot blocked.
Then, with ten minutes left, Chris Hegarty headed home from a Clarke cross only for the 'goal' to be ruled out offside.
But that was how it stayed with the Blues going into the return next Thursday evening at Windsor Park with a real chance of progressing.
Spartak Trnava: Jakubech, Tóth, Conka, Godál, Baéz, Mikovič, Casado, Nikolić, Sabo, Halilović, Harba subs Kneževic (not used), Bortel (replaced Harba 46), Gressak (replaced Tóth 70), Vojtuš (not used), Schranz (not used), Mikinič (Casado 64)
Linfield: Ross Glendinning, Hegarty, Haughey, M. Clarke, Reece Glendinning, Lowry, Burns, Kee, Waterworth, Bates, Sproule subs Deane (not used), Wallace (not used), Quinn (not used), Murray (not used), Mulgrew (not used), R. Clarke (replaced Burns 57), Millar (not used)