1 Samuel 2:2, says,
Hannah prayed this prayer when she handed over her son, Samuel, to work for God. God filled her with his Spirit and with joy as she praised him. It seems clear that she did not just speak these words from her own mind.
God showed her what she should say.
In 1 Samuel 2:1, Hannah spoke about the good things that God does for his people. However, God’s people do not only praise him because of the things that he does for them. They also praise him because of who he is. In other words, they praise him because of his perfect and wonderful character. He is the holy God; and he is the only God. All other gods are therefore false gods. None of them has the right to be called holy. None of them is like the real God. So really, they are not gods, although people may wrongly call them that. Hannah calls God her ‘Rock’, that is, her strong defence. In several places, the Bible calls God a ‘Rock’. For example, see Deuteronomy 32:4 and Psalm 18:2. As a storm has no effect on a strong rock, so troubles cannot disturb God. As a house on rock stands firm Matthew 7:24-27, so God’s people can always trust him. They do not need ever to be afraid, because he will never disappoint them. People may imagine that a false god can provide safety; but of course, they are wrong.
No other god can save (or rescue) his people. No other god can keep his people safe.
Only the real God who created heaven and earth, can do these things.