Goals from Steven Hammell and Lionel Ainsworth equalled the away tally of Stjarnan, who levelled the Europa League second qualifying round tie 4-4 on aggregate with an Olafur Finsen penalty and a late Rolf Toft strike before the extra-time winner from Atli Johansson.
The visitors forced a succession of early corners on the artificial surface and the pressure paid off when Hammell powered a header into the top corner from Ainsworth's delivery on 11 minutes.
Keith Lasley came close from another corner when he fired just wide and Motherwell were looking comfortable, but Hammell had to throw himself in front of Toft's shot to prevent an equaliser.
But Lasley then conceded his third penalty of the tie when he brought down Johansson, and Finsen confidently sunk the spot-kick.
The Motherwell skipper tried to atone for his error and his well-struck volley just before the break forced Ingvar Jonsson into action.
Motherwell almost fell behind early in the second half but Dan Twardzik came off his line quickly to foil Toft.
However, Lasley had a shot deflected over, Craig Reid's cross was then deflected on to the post and Ainsworth's delivery was just turned wide as Motherwell piled the pressure on.
And Motherwell were rewarded when a delightful delivery from Josh Law was volleyed past the keeper from close range from Ainsworth.
With just five minutes of regulation time remaining, Toft shot into the top corner from the edge of the box.
And Stjarnan set up a third qualifying round tie with Lech Poznan when Johansson fired a long-range volley in off the bar with seven minutes remaining.