The New Saints gave themselves chance of advancing past the Europa League first qualifying round after a hard-fought first leg at Fram Reykjavik.
Steve Evans put the Welsh Premier side ahead with a 23rd-minute header from Scott Ruscoe's left-wing cross.
Sam Tillen equalised for the Icelanders from the penalty spot after he had been fouled by Conall Murtagh.
Heidar Geir Juliusson hit the winner from 12 yards on 48 minutes after Evans missed Almar Ormarsson's cross.
The second leg is at the Saints' Park Hall Ground in Oswestry on 9 July, with the overall winners advancing to face Sigma of the Czech Republic in the next round.
Fram are eighth out of 12 in the Iceland Premier League, with just three wins from 10 league games.
The New Saints were third behind Rhyl and Llanelli in the Welsh Premier last season, the first time in eight years that they had finished outside the top two.
In 10 previous attempts at European competition the Welsh side have always fallen at the first hurdle.
Bookmark with:
What are these?