A. For a US corporation to do business in Spain you could either start operating directly in Spain registering as a foreign company with a branch office or incorporating a Spanish limited company, owned by the mother company based overseas.
In the first case, the requirements are the same as for any Spanish company, although the tax assessment would be done differently. In both cases, you would need to prepare translated copies of several documentation, such as deeds of incorporation or formation, articles of association and board meeting approving the decision to start operating in Spain.
Depending on the kind of business or trade, it is necessary to obtain the administrative permissions and authorisations from the relevant authorities. With regards to the fees, I cannot give you one figure, since it depends on many factors. But as an orientation, a Spanish plc with a minimum starting capital of 2.000$, a safe cost estimate is 5.000$ between notary public fees, administrative fees and lawyers' fees.