The 22-year-old woman died of her injuries in hospital - and three other Moroccans were wounded.
One of them has been left in a critical condition and has had their arm amputated, according to the Northern Observatory for Human Rights.
Morocco's interior ministry said the patrol was "forced" to open fire on the speedboat because the captain had "refused to obey" orders in waters off M'diq-Fnideq.
A total of 25 people were on board, including Spanish people traffickers.
According to an official, those on the speedboat were lying down and could not be seen.
The Spanish captain was unharmed. He was arrested and an investigation has been opened.
So far in 2018, Morocco says it has foiled 54,000 attempts by illegal migrants to cross from the Mediterranean into Europe after becoming a key route for sub-Saharan Africans trying to reach the continent.