The preposition "por" is used as a causal conjunction to express due to / because of / for. You can say something happens because of something, because of doing something or for having done something.
Learn how to use causal clauses with por in Spanish
(because of something)
(for/because of doing something)
(for having done something)
All the examples above are expressing the "cause" of what happens in the main clause.
The last two examples are showing a subordinate clause introduced by por. Note that after "por" Infinitivo or El Infinitivo Compuesto are used. We cannot use a conjugated verb after por.
This would be incorrect:
Me riñeron por llegamos tarde.
Nos felicitaron por habíamos aprobado todo con una nota alta.
To use a conjugated verb you need porque:
Me riñeron porque llegamos tarde.
Nos felicitaron porque habíamos aprobado todo con una nota alta.
See also Using porque, como and es que to express cause (subordinate causal clauses) and Using Spanish conjunction al + infinitive/perfect infinitive = when doing/ because of doing [something]
Want to make sure your Spanish sounds confident? We’ll map your knowledge and give you free lessons to focus on your gaps and mistakes. Start your Brainmap today »