The star studied "Hamlet" at school and admits The Bard's words came to him as he was composing the song.
"One interesting thing about Let It Be that I was reminded of only recently is that, while I was studying English literature at the Liverpool Institute High School for Boys with my favourite teacher, Alan Durband, I read Hamlet," McCartney explains.
"In those days you had to learn speeches by heart because you had to be able to carry them into the exam and quote them. There are a couple of lines from late in the play: 'But let it be, Horatio, I am dead (Let it be, Horatio, I'm dying).' "
In his new book, "The Lyrics: 1956 to the Present" - extracts of which have been published in the Sunday Times newspaper - Paul recalls, "I suspect those lines had subconsciously planted themselves in my memory."
He also reveals The Beatles were very close to calling it a day and splitting for good as he wrote the song, and admits the tensions within the band helped him create the lyrics to the classic song.
"When I was writing Let It Be, I'd been doing too much of everything, was run ragged, and this was all taking its toll. The band, me - we were all going through times of trouble, as the song goes, and there didn't seem to be any way out of the mess."
"I fell asleep, exhausted one day and had a dream in which my mum, Mary, (who had died just over ten years previously) did, in fact, come to me. When you dream about seeing someone you've lost, even though it's sometimes for just a few seconds, it really does feel like they're right there with you, and it's as if they've always been there."
"I think anyone who's lost someone close to them understands that, especially in the period of time just after they've passed away. Still to this day I have dreams about John (Lennon) and George (Harrison) and talk to them. But in this dream, seeing my mum's beautiful, kind face and being with her in a peaceful place was very comforting. She seemed to realise I was worried about what was going on in my life and what would happen, and she said to me, 'Everything will be all right. Let it be.' "