Avicii was hanging on a yacht and sipping a drink the day before his death ... and appeared to be happy and healthy.
In the photo -- obtained by TMZ -- the world-famous DJ is chilling with a couple guys on a boat while flashing a peace sign. We're told it was taken Thursday in Muscat, Oman ... where he was staying nearby at the Muscat Hills Resort.
Avicii has a drink in his hand, but it's unclear if it's alcoholic or not. Avicii said in a 2013 interview he stopped drinking due to pancreatitis and was living a sober lifestyle.
As we reported ... Avicii was found dead Friday morning in Muscat. The resort confirmed he was a guest and said he was extremely kind during his stay and "definitely did seem to be in good spirits while enjoying his time." Photos taken with other guests at the resort seem to back that up.
Avicii's brother is currently in Oman leading the charge to find out what killed him.