It depends on which sort of Apple Spanish keyboard you have and the input source setting which matches the printing on the keys
You can check this in system preferences -> keyboard -> Input sources.
An Apple Spanish Magic Keyboard normally follows the Spanish ISO input source mapping. With this square brackets are at option plus and option backtick.
On a laptop you could also have a Spanish Latin America hardware keyboard. With this mapping square brackets are at shift curly brackets.
Here are some screenshots from the Spanish ISO keyboard layout (second one is the modification by pressing the option key). You can look them up yourself if you activate the "show menu in menu bar" (located in bottom of the keyboard settings in system preferences) and then go in the dropdown menu in your menu bar and select "Show Keyboard Viewer".