I like the following a bit better as you don't have to find out how many rows you're going to affect before affecting them. YMMV.
declare @rowcount int
set @rowcount = 1
declare @batchsize int
set @batchsize = 5000
while(@rowcount > 0)
begin
delete top @batchsize from table where foo=1
set @rowcount = @@rowcount
end