Yes, there are two ways. First: apply at the Spanish consulate in your country of residence, although processing times are usually 3 to 6 weeks. Second: through a representative in Spain with a specific power of attorney.
In the second case, you sign the power of attorney before a local notary, have it apostilled, and send it to Spain. Your representative submits the application at the foreigners' office and collects the NIE. At Notaría Online we manage this entire process.