Look at the hole, it should be no larger than a quarter. Clean around the edges pulling all the loose material away. If need be sand or scrape loose material making the wall area around the hole smooth. Loose material around the patch will not make the patch solid.
Open the spackle and take a fair amount on the puddy knife and spread over the hole. If spackle falls though the hole when you spread the spackle over it get yourself some paper and fill the hole, giving the spackle something to grab onto. Do not just cover the hole, but also flare the mud out about 6 inches around the hole. Let dry.
When the spackle is dry rub your hand over the area and feel for rough areas. Take a piece of fine sandpaper or sanding sponge, and smooth the roughness down. Keep rubbing your hand over the area, as well as looking down the wall to see if the patch is smooth. Look where the spackle meets the wall and flare that area to where it does not have a ridge. If there is a ridge in this area it will show after repainting the wall.
Wipe away all the excess dust and mask off the area you do not want textured. Read the instructions on the can of spray texture, and try a couple samples on some cardboard till you get the right match. Spray the texture on the wall in a circular motion. Let dry and paint, flaring the paint in the same manner you did the spackle.