If you're talking a 2D tile map it's better to use PASTE IMAGE rather than making all of them sprites. But with sprites the natural sprite priority is by the image number the sprite uses. Like if you had 5 sprites with image numbers 1-5 the one at the bottom will always be the one using image number 1, then 2, then 3, and so on. Doing it the "natural" way takes a bit of planning or you can use the method that Phaelax mentioned to make it easier (SET SPRITE PRIORITY).
To show you how natural sprite priority is the following randomly creates 17 sprite numbers but uses image numbers 1 to 17 on the screen and another sprite for the mouse coordinates. Move the mouse around the screen to see which image numbers are in front of and behind whatever image number the mouse sprite is using. Click the mouse button to randomly pick another image number.
` Create 17 sprites
for ImageNum=1 to 17
` Pick a random sprite number between 1 and 999
repeat
SpriteNum=rnd(998)+1
until sprite exist(SpriteNum)=0
` Create a box
ink rgb(rnd(255),rnd(255),rnd(255)),0
box 0,0,50,50
ink rgb(255,255,255),0
` Show sprite number on the box
center text 25,0,"Image"
` Show image number on the box
center text 25,30,"# "+str$(ImageNum)
` Grab the image
get image ImageNum,0,0,50,50,1
` Create the sprite
sprite SpriteNum,ImageNum*40-40,ImageNum*10,ImageNum
next ImageNum
hide mouse
` Pick a random starting image number
MImage=rnd(16)+1
tim=timer()
do
` Show the mouse
sprite 1000,mousex(),mousey(),MImage
` Check for mouseclick
if mouseclick() and timer()>tim+200
` Pick a random image number
MImage=rnd(16)+1
` Reset timer
tim=timer()
endif
loop