No opening licence needed, as you don’t have actual premises from where you sell to the public, but there are a whole lot of other laws and regulations that you will have to comply with.
First, you need to register as self employed Autonomo, both with the Tax Office and the Seguridad Social TGSS and inform yourself about your tax obligations, both with regards to IVA (VAT) and IRPF (income tax). Engaging a gestor to advise you about this and take care of the practical side, filing your tax declarations etc. is highly recommended.
Then, the business and the website you create need to comply with:
Ley de Ordenación del Comercio Minorista / Retail Trade Ordenance Law
LSSI (Ley de Servicios de la Sociedad de la Informacion y Negocio Electronico) en tu tienda virtual / LSSI ( Law of Services of the Information Society and Electronic Business) in your virtual store
Ley de Protección de Datos (LOPD) / Law on Data Protection
Las condiciones de uso / The conditions of use
La Ley de Consumidores y el comercio electrónico / the Consumer Law and electronic commerce
More info in this article, in Spanish.