Compost is rich in organic matter and helps improve soil structure, moisture retention, and microbial activity. It’s benefits are primarily seen over the long term.
Fertilizer primarily provides easily available nutrients to plants, and provide a short term benefit to the plants. However, if overused it can be harmful to soil.