Pemetrexed works by inhibiting three key enzymes involved in the folate pathway: thymidylate synthase (TS), dihydrofolate reductase (DHFR), and glycinamide ribonucleotide formyltransferase (GARFT). By blocking these enzymes, pemetrexed disrupts the synthesis of DNA and RNA, which is crucial for the growth and replication of cancer cells. This ultimately leads to the death of rapidly dividing cancer cells.