The spoils system was a method of appointing officials to the government of the United States of America based on political connections rather than on impersonal measures of merit. The name was derived from the phrase "to the victor go the spoils".
It was a contentious feature of the presidencies of Andrew Jackson, who introduced it as a democratic measure informed by his understanding of the nature of party politics and democracy. He considered that popular election gave the victorious party a mandate to select officials from its own ranks. The spoils system was closely linked to the new party system which he was instrumental in creating, generally known to scholars as the "second party system" (the first being the system which emerged in the aftermath of the ratification of the American Constitution). Opponents considered it vulnerable to incompetence and corruption.
The system was formally ended in 1883 with the passage of the Pendleton Act. This introduced the concept of a separate government and civil service to American governance. The government would continue to be formed by the party of the winner of the Presidential election. The civil service was separated out; appointment to it was based on merit and not tied to any particular government, a state of affairs that continues today.
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.