The Embassy of Spain in Islamabad notes, that should you not be granted a visa, you will receive a written document or letter that says why you were refused. It will also tell you that you can appeal to the Consulate in Islamabad and/or to the High Court of Justice in Madrid. From the date of the refusal notice, you have 30 days to lodge your appeal at the Consulate, and 60 days in which to do so at the HCJ Madrid.
There is not an online portal nor should it be done via email. Rather, using the refusal letter, and addressing the stated reasons, you appeal to directly to the Consulate and/or the High Court of Justice in Madrid. The following are for reference and it is better to use the instructions contained in the refusal document/letter for how and where to appeal.
Spain’s Islamabad Consulate is located at Street 6, Ramna 5. Diplomatic Enclave I.
Telephone office: (051) 208 87 77
Please be aware that questions about visa or Consular procedures are not responded to by phone or email, but are dealt with at the Embassy during normal office hours.
Tribunales Superiores de Justica Madrid
Calle del Gral. Castaños, 1, 28001 Madrid, Spain
Phone: +34 603 35 77 34