A full summary of Tuesday's Premiership results
Partick Thistle and Ross County's defeats set up a nail-biting finish in the bottom six.
After a hard-fought match at Pittodrie it all stayed the same at the top end of the table with Aberdeen and Rangers remaining in second and third place in the Premiership.
Aberdeen took the lead after just 14 minutes when referee Steven McLean ruled that Kenny McLean had been fouled by Alfredo Morelos and pointed to the spot. McLean took the penalty himself and sent Jak Alnwick the wrong way.
Rangers got back on level terms on 63 minutes and it was Ross McCrorie who scored the headed equaliser. Neither side could find a winner, setting up what could be a dramatic final day.
Hamilton lost at New Douglas Park but are all but assured of staying up thanks to results elsewhere.
The opener came from the spot on 65 minutes after George Williams was fouled and David McMillan made no mistake with the penalty.
Fifteen minutes later the visitors doubled their lead through David Wotherspoon but Accies pulled a goal back almost instantly through captain Dougie Imrie.
Hamilton are three points ahead of Partick Thistle and 13 goals better off going into the final day.
Thistle were hoping a defeat for County in Dingwall coupled with a win over the Steelmen could relieve them of their fears of finishing bottom but fell to defeat against the Scottish Cup finalists.
Motherwell went ahead on 58 minutes when David Turnbull's free kick was met by Ryan Bowman who powered a header in.
County moved closer to relegation with a home defeat that kept them two points adrift at the foot of the table with one game left to play while Dundee ensured they'll be a Premiership side next season.
After Davis Keillor-Dunn had squandered a good chance for County early in the second half, Dundee dealt them a painful blow.
Randy Wolters cross bounced and Simon Murray pounced to head past Aaron McCarey.