There are several conditions for this. First, the people who listened to the sermon must have some amounts of paramis (perfections of virtue). Second, they must pay wholesome attention to the sermon. Third, they must practice according to the instruction during the sermon. Fourth, the preacher of the sermon must be skilled in the Dhamma and be able to prepare the people's minds for the Noble Dhamma (i.e. such as the Buddha).
And there may be more conditions that are not mentioned here.