See A. A. Hoogenboom, Outlawing the Spoils (1968); W. d. Foulk, Fighting the Spoilsmen (1974).
The term was derived from the phrase "'to the victor go the spoils''."
The end of the spoils system at the federal level came with the passage of the Pendleton Act in 1883, which created a bipartisan Civil Service Commission to evaluate job candidates on a nonpartisan merit basis. While few jobs were covered under the law initially, the law allowed the President to transfer jobs (and their current holders) into the system, thus giving the holder a permanent job. The Pendleton Act's reach was expanded as the two main political parties alternated control of the White House in every election between 1884 and 1896. After each election the outgoing President applied the Pendleton Act to jobs held by his political supporters. By 1900, most federal jobs were handled through civil service and the spoils system was limited only to very senior positions.
The separation between political activity and the civil service was made stronger with the Hatch Act which prohibited federal employees from engaging in political activities.
The spoils system survived much longer in many states, counties and municipalities, such as the Tammany Hall ring, which survived well into the 1930s when New York City reformed its own civil service. Illinois modernized its bureaucracy in 1917 under Frank Lowden, but Chicago held on to patronage in city government until the city agreed to end the practice in the Shakman Decrees of 1972 and 1983.