In this case, there are two rules to combine:
- Always write a comma before an adversative conjunction (such as pero)
- All constructions meaning of course (such as por supuesto, naturalmente, desde luego...) must be surrounded by commas
You put these two norms together and get the correct punctuation, which is the one you write in your question:
Universidad Católica fue puntero toda la liga, pero, por supuesto,
salieron segundos.
There is a concordance error in this sentence, but that's a different thing.
Ommitting the commas can lead to a different meaning in some sentences using these elements. For instance:
El gato es, naturalmente, un carnívoro, pero puede subsistir con una
dieta omnívora.
This means: The cat is, of course, a carnivore, but it can subsist on an omnivorous diet.
On the other hand:
El gato es naturalmente un carnívoro, pero puede subsistir con una
dieta omnívora.
This means: The cat is a carnivore by nature, but it can subsist on an omnivorous diet.