In the following link you may find a post from my blog in which I describe a way to build spatial algorithm using ModelBuilder.
http://pantelisrodis.blogspot.gr/2014/06/building-spatial-algorithms-with.html