The only way to be saved from hell is through iman (faith) and righteous deeds. So the Muslims pray to their Lord with faith to save them from the Fire. Allah said:

”Those who say, Our Lord! We have indeed believed. Forgive us, then, our sins and save us from the agony of the Fire.”

Many hadiths speak in details about this matter and describe the deeds that will protect one from the Fire, for example, love of Allah. The Prophet (SallAllahu Alaihi Wa Sallam) said:

”By Allah, Allah will never throw one who loves Him and whom He loves into the Fire.”

Fasting is also a source of protection from the Fire, as reported from Jabir ibn Abdullah (RadiyAllahu Anhu), the Prophet (SallAllahu Alaihi Wa Sallam) said:

”Allah, the Exalted, says: “Fasting is a shield with which one may protect oneself from the Fire.””

Al-Bayhaqi reports from Uthman ibn Abi al-Ash (RadiyAllahu Anhu) that the Prophet (SallAllahu Alaihi Wa Sallam) said:

”Fasting is a shield from the punishment of Allah.”

If fasting is accomplished at the time of jihad against the enemy, then that is a great victory, as it is reported from Abu Sa’eed al-Khudri (RadiyAllahu Anhu) that the Prophet (SallAllahu Alaihi Wa Sallam) said:

”Whoever fasts for one day when he is engaged in jihad for the sake of Allah, Allah will remove him ‘seventy years’ distance from the Fire.”
[Bukhari and Muslim]

Other means of salvation from the Fire are fear of Allah, and jihad for His sake. Allah (swt) said:

”But for him who fears the standing before his Lord, there will be two gardens in Paradise.”
(Qur’an 55: 46)

The Prophet (SallAllahu Alaihi Wa Sallam) said:

”No one who weeps out of fear of Allah will enter Hell until the milk goes back into the breast, and a man will never have both the dust from fighting in the way of Allah and the smoke of Hell.”
Bukhari reports from Abu Abs that the Prophet (SallAllahu Alaihi Wa Sallam) said:
”No two feet that get dusty for the sake of Allah will ever be touched by the Fire.”

We may also be shielded from the Fire by seeking protection with Allah from it. Allah said in the Qur’an:

”Those who say:” Our Lord! Avert from us the wrath of Hell, for its wrath is indeed an affiliation grievous. Evil indeed is it as an abode and as a place to rest in.”
(Qur’an 25: 65-66)

Ahmad, Ibn Majah, Ibn Hibban, and Al-Hakim report, with a saheeh isnaad from Anas (RadiyAllahu Anhu), that the Messenger of Allah (SallAllahu Alaihi Wa Sallam) said:

”No one asks Allah for Paradise three times, but Paradise will say: O Allah, 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.”

Bukhari and Muslim report from Abu Hurairah (RadiyAllahu Anhu) that when the Prophet (SallAllahu Alaihi Wa Sallam) was discussing the angels who seek out gatherings of dhikr, he said:

”.. Allah 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 Lord, they have not seen it? They say: ”They would be even more afraid and anxious to escape it.’

He says:
“Bear witness that I have forgiven them.’”