Ansoain is a town and municipality located in the province and autonomous community of Navarra, northern Spain.