As it is kufr that will condemn a person to eternal Hell, the way to be saved from Hell is through iman and righteous deeds. So the Muslims pray to their Rabb with faith to save them from the Fire:

“Those who say, “Our Rabb! We have indeed believed, forgive us then, our sins and save us from the agony of the Fire“. (3:16)

“…Our Rabb! Not for naught have You created [all] this, glory to You! Give us salvation from the torment of the Fire. Our Rabb! Any whom You admit to the Fire, truly You cover with shame, and never will wrongdoers find any helpers. Our Rabb! We have heard the call of one calling [us] to faith: “Believe in your Rabb,” and we have believed. Our Rabb! Forgive us our sins and blot out from us our inequities, and take to Yourself our souls in the company of the righteous [al-Abraar]. Our Rabb! Grant us what You did promise unto us through Your Messengers and save us from shame on the Day of Judgement, for You never break Your Promise“. (3:191-194)

Many ahadith speak in detail about this matter and describe the deeds that will protect one from the Fire, for example, the love of Allah (SWT). In al-Haakim’s al-Mustadrak, and Ahmad’s al-Musnad, a report from Anas ibn Maalik (ra) states, “The Messenger of Allah (saw) said, “By Allah (swt), Allah will never throw one whom He loves into the Fire(sahih, See Sahih al-Jaami’ 6/104)

Fasting is also a source of protection from the Fire, as Ahmad reports in al-Musnad and al-Bayhaqi in Shu’ab al-Imaan, with a hasan isnaad from Jaabir ibn ‘Abdullaah: “The Prophet (saw) said, “Allah (SWT) says, “Fasting is a shield with which one may protect oneself from the Fire“. (Sahih al-Jaami, 4/114)

In Shu’ab al-Imaan, al-Bayhaqi reports from ‘Uthmaan ibn Abil-Aas that the Prophet (saw) said, “Fasting is a shield from the punishment of Allah (SWT)” It was reported by Ahmad, an-Nasaa’ee, Ibn Maajah and Ibn Khuzaymah and its isnaad is saheeh (Sahih al-Jaami’ 3/264).

If fasting is accomplished at the time of jihad against the enemy, then that is a great victory, as it was reported from Abu Sa’eed al-Khudree that the Messenger of Allah (saw) said: “Whoever fasts for one day when he is engaged in jihad for the sake of Allah, Allah will remove him [lit. his face] seventy years distance from the Fire“. (Ahmad, al-Bukhaari, Muslim, at-Tirmidhi and an-Nasaa’ee – Sahih al-Jaami’ 5/310)

Other means of salvation from the Fire are fear of Allah and jihad for His sake:

But for him who fears the standing before his Rabb, there will be two gardens [ie in Paradise](55:46)

at-Tirmidhi and an-Nasaa’ee reported from Abu Hurayrah (RA) that the Messenger of Allah(saw) said: “No one who weeps out of fear of Allah will enter Hell until the milk goes back into the breast [i.e. never] and a man will never have both the dust from fighting in the way of Allah (SWT) and the smoke of Hell“. (Mishkaat al-Masaabeeh, 2/356, no. 3828, isnaad is sahih)
al-Bukhaari reports from Abu ‘Abs that the Messenger of Allah (saw) said, “No two feet that get dusty for the sake of Allah (SWT) will never meet in the Fire of Hell“. (Mishkaat al-Masaabeeh, 2/349, no. 3794)

Muslim reports from Abu Hurayrah (RA) that the Messenger of Allah (saw) said, “A Kaafir and the one who kills him will never meet in the Fire of Hell. (Mishkaat al-Masaabeeh, 2/349, no. 3795)

We may also be shielded from the Fire by seeking protection with Allah from it:

“Those who say, “our Rabb! Avert from us the wrath of Hell, for its wrath is indeed an affliction grievous.” Evil indeed is it as an abode and as a place to rest in“. (25:64-65)

Ahmad, Ibn Maajah, Ibn Hibbaan, and al-Haakim report with a sahih isnaad from Anas, that the Messenger of Allah (saw) said, “No one asks Allah (SWT) for Paradise three times, but Paradise will say, “O Allah (SWT) admit him to Paradise”. And no Muslim asks Allah for protection from Hell three times, but Hell will say, “O Allah save him from me(Sahih al-Jaami, 5/145, no.5506)

al-Bukhaari and Muslim report from Abu Hurayrah (RA) that when the Prophet (saw) was discussing the angels who seek out gatherings of dhikr he said, “Allah (SWT) asks them and He knows best, “What are they seeking protection from?” They tell Him, “From the Fire”. He asks, “And have they seen it.” They say, “No, by Allah, O Rabb, They have not seen it.” He says, “How would it be if they had seen it?” They say, “They would be even more afraid and anxious to escape it”. He (SWT) says, “Bear witness that I have forgiven them“. (Sahih al-Jaami’, 2/233, no. 2169)