All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
Allaah, The Most-High, sent down the message to His Prophet, Muhammad, who was illiterate and could neither read nor write. Allaah The Almighty Says (what means): {And you did not recite before it any scripture, nor did you inscribe one whatsoever with your right hand. Then [i.e. otherwise] the falsifiers would have had [cause for] doubt.} [Quran, 29: 48]
The Prophet’s being illiterate and not knowing how to read or write is one of the greatest evidences that he was really a prophet and that he was sent by Allaah, the Most-High. How could an illiterate person bring the Quran, if not by way of revelation? Allaah The Almighty Says in the verse above (what means): {…the falsifiers would have doubted.} If the Prophet, sallallaahu ‘alayhi wa sallam, had not been illiterate, the polytheists would have claimed that what he came with was of his own invention and thoughts, and that he had collected it from previous books. Since he was illiterate and came with this magnificent Quran, this proves that it is a revelation from Allaah The Almighty. Allaah The Almighty Says (what means): {Certainly did Allaah confer [great] favour upon the believers when He sent among them a Messenger from themselves, reciting to them His verses and purifying them and teaching them the Book [i.e. the Qur’aan] and wisdom, although they had been before in manifest error.} [Quran, 3:164]
The answer to the saying of the questioner 'how was the Prophet, sallallaahu ‘alayhi wa sallam, able to read the Quran?' is that it was Jibreel who taught him, as Allaah The Almighty Says (what means): {He has been taught the Qur'aan by one mighty in power (Jibreel)} [Quran, 53:5]
The Prophet, sallallaahu ‘alayhi wa sallam, at the very first stages used to repeat the Quran with his tongue, lest he should forget it. So Allaah The Almighty forbade him from doing so, as Allaah The Almighty Says (what means): {And do not be in haste with the Qur'aan before its revelation is completed to you.} [Quran, 20:114] So Allaah The Almighty promised to preserve the Quran in the bosom of the Prophet, sallallaahu ‘alayhi wa sallam, in a manner that he would not forget. Allaah The Almighty Says (what means): {Move not your tongue with it, (O Muhammad ), to hasten with it (i.e. recitation of the Quran). Indeed, upon Us is its collection (in your heart) and (to make possible) its recitation.} [Quran, 75:16-17] Meaning that Allaah The Almighty will certainly preserve it in the Prophet's, sallallaahu ‘alayhi wa sallam, heart, and he will read it to the people without forgetting anything in it.
Allaah The Almighty further Says (what means): {So when We have recited it (through Gabriel), then follow its recitation.} [Quran, 75:18] This verse means, when Jibreel reads it, listen to it. {Then upon Us is its clarification [to you]} [Quran, 75:19], that is to say, after you memorize it We will clarify it to you. So Allaah The Almighty promised to preserve the Quran in the heart of His Prophet, sallallaahu ‘alayhi wa sallam, and to clarify to him its meaning. Allaah The Almighty Says (what means): {We shall make you to recite the Quran so you shall not forget it.} [Quran, 87:6]
As for the saying of the questioner 'how was he able to read the verses revealed to him in the cave of Hiraa'?', the answer to this is that he was taught by Jibreel . An illiterate person who cannot read from books or write, is taught orally.
Allaah Knows best.