Masquefa is a municipality located in the Anoia comarca within the Catalonia region of Spain. It sits on the edge of the Penedès Depression, positioned along the road connecting the towns of Piera and Martorell.
The municipality is served by a railway station on the FGC line R6. This rail line connects Barcelona to Igualada via Martorell.