at lege means to play in the sense of a game without any rules (such as playing with dolls or children playing in a park, or playing with Lego), it's also used for Athletics sometimes (e.g. Olympiske Lege) and one would "Lege en leg"
at spille means to play games such as board games, video games and sports (like football, rugby, cricket, etc) and on would "Spiller et spil"
Although this flow chart and explanation is in Danish, I think it explains it pretty well
They should be interchangeable when translating from English (but don't know if both are accepted for ALL sentences) provided you don't cross them in a way such as Jeg spiller en leg or Jeg leger et spil