Ibuprofen works by inhibiting the activity of cyclooxygenase enzymes (COX-1 and COX-2). These enzymes are responsible for the synthesis of prostaglandins, which are mediators of inflammation and pain. By reducing prostaglandin levels, ibuprofen effectively alleviates symptoms such as pain, fever, and inflammation.