Linfield kept alive their hopes of progressing from the Europa League second qualifying round thanks to a battling 2-1 defeat in their first leg.
The Slovakian side took the lead with a penalty from captain Erik Sabo.
David Kee levelled soon after with a spectacular free-kick from the edge of the box but Martin Mikovic restored his side's lead from close range.
Milos Nikolic was sent off for a second yellow card just before half-time but the Blues could not add to their tally.
In the second half, Ross Clarke had a goalbound shot blocked, while Chris Hegarty headed a Clarke free-kick into the net but it was ruled out for offside.
The first chance of the game fell to the hosts but Haris Harba's header came off the woodwork.
At the other end, Aaron Burns hooked an effort over the bar for the Irish Premiership outfit, then Harba shot wide for Trnava from a good position.
Ross Glendinning conceded the penalty which allowed Sabo to score from the spot in the 16th minute, but five minutes later, midfielder Kee levelled with his expertly executed set-piece to register a potentially crucial away goal.
Jose Casado saw a long-range effort well saved by Glendinning but Mikovic made no mistake from six yards out, firing home his team's second, after the visitors failed to clear the initial cross.
Glendinning made a fine save to deny Emir Halilovic but Warren Feeney's side were handed a boost before the interval when their opponents were reduced to 10 men.
The second half was less eventful, although Topmas Mikinic fired narrowly wide from 12 yards for the home side.
The teams will meet at Windsor Park for the second leg on Thursday, 23 July.