Cowdenbeath beat 10-man Hamilton 3-1 to secure their Scottish First Division status.
Hamilton went 1-0 up in the 27th minute when Steven May flicked the ball past Cowdenbeath stopper Thomas Flynn from close range to score his 25th league goal of the campaign.
The hosts were reduced to 10 men four minutes later when striker Andrew Ryan saw red for violent conduct.
Beath drew level within three minutes of the restart when Scott Linton got on the end of Marc McKenzie's cross to head past Kevin Cuthbert from six yards out.
The visitors took the lead in the 72nd minute when Craig Moore bundled in from close range before substitute Marc McKenzie drilled in from the right of the box to make it 3-1.