Simply by saying with conviction, “La ilaha illa Allah, Muhammadur rasoolu Allah,”
This saying means “There is no true god (deity) but God (Allah), and Muhammad is the Messenger (Prophet) of God.” The first part, “There is no true god but God,” means that none has the right to be worshipped but God alone, and that God has neither partner nor son. To be a Muslim, one should also:
Believe that the Holy Qur'an is the literal word of God, revealed by Him.
Believe that the Day of Judgment (the Day of Resurrection) is true and will come, as God promised in the Qur'an.
Accept Islam as his or her religion.
Not worship anything nor anyone except God.
The Prophet Muhammad said: "God is more joyful at the repentance of someone when he turns to Him in repentance than one of you would be if he were riding his camel in the wilderness, and it runs away from him, carrying his food and drink, so that he loses all hope of getting it back. He comes to a tree and lies down in its shade (awaiting death), for he has lost all hope of finding his camel. Then, while he is in that state (of desperation), suddenly it is there before him! So he seizes its halter and cries out from the depth of his joy, (O God, You are my servant and I am Your Lord!) His mistake comes from the intensity of his joy." [Al-Bukhari and Muslim]