A Dex build also works for a Beastmaster ranger. Haven't tried it since patch 1, but the spider is (was?) basically a dragon. It functionally flies, and shooting webs at fire sources lets it create fire surfaces at great range.
Your ranger doesn't need to be highly optimized when you're rollin' with a dragon, but a Dex based wood elf can hang back next to the spider to protect it with finesse weapons while still impacting battle with Hunter's Mark and a longbow.
If close range is more your style, I'd add to @TomReneth's suggestion that having the jump spell (or picking Githyanki over Wood-elf) lets you get easily into position. The blade-ward cantrip can also help tank in melee range.