Aspirin works by inhibiting the production of certain chemicals in the body that cause pain, inflammation, and fever. It blocks the enzymes responsible for generating these substances, providing pain relief.