The invitation letter is generally a long procedure. it is not just a handwritten letter but is issued by Spanish police. The procedure is to request for a cita at extranjeria, show documents of your house etc, and then waiting for resolution.. finally when the letter is issued, it has to be posted by mail to the traveler.
Which is why, i recommend the latter option, i.e. book hotel tickets and cancel them later. you can also write a supporting invitation letter signed by you stating that you want your friend to visit you.