This is a complicated and controversial question. I would argue that the two sides initially were fighting over the issue of states' rights. However, it is important to realize that one of the most prominent states' rights in question was the right to hold slaves.
The South clearly was fighting over states' rights. They wanted to guaranteed right to run their states as they wished. One of the most important rights on their list was the right to own slaves. However, they did also care about other issues, as was seen in the controversy over the tariff in the late 1820s and early 1830s.
The North was fighting largely to defeat the South's view that the states should have expansive rights. The North wanted to preserve the Union with a strong central government. They were not trying to end slavery just as most Northerners before the war were not in favor of abolishing slavery in the South.
The war started out, then, as a war over the degree to which states would have autonomy. However, slavery was a major issue in the debate over autonomy.
Initially, the North went to war with the South because of slavery. The South, whose economic back bone was agriculture, solely utilized slave labor in its venture, unlike the North where industrialization and modernization had taken root. The North made use of free labor and in the 1850s had an increased interest towards the protection of free labor. This was in conflict with the South which was interested in expanding its slavery claims. During this period until the start of the 1860’s, the North and South differed greatly on slavery matters despite efforts by politicians to reach a compromise. The South was met with political resistance from the North whenever it attempted its slave expansionist agenda into other territories and even threatened to secede if they encountered further frustrations. When Abraham Lincoln, a passionate anti-slavery advocate, took over the presidency in 1860, seven southern states seceded, and when the North refused such a move, the question of states’ rights arose. They were of the opinion that this was interference with their state sovereignty and the tension finally culminated in the civil war in 1861. Therefore, slavery is what initially sparked the war between the two sides but later, the element of states’ rights cropped up.