In the Lotus Sutra, a very important text of Mahayana Buddhism which is viewed as containing the entirety of the Buddhist teachings, the Buddha says there are "innumerable skillful means" for attaining enlightenment. Below is a passage from the Digha Nikaya (Long Discourses of the Buddha) where a wanderer named Subhadda asks the dying Buddha whether there is any merit in the teachings of masters of other traditions.

Then Subhadda went to the Blessed One and exchanged courtesies, and after the exchange of courtesies sat down to one side. As he was sitting there, he said to the Blessed One, 'Venerable sir, these priests and contemplatives [of other traditions], each with his group, each with his community, each the teacher of his group, an honored leader, well-regarded by people at large: Do they all have direct knowledge as they themselves claim, or do they all not have direct knowledge, or do some of them have direct knowledge and some of them not?'

...and the Blessed One said, 'In any doctrine and discipline where the noble eightfold path is not found, no contemplative of the first...second...third...fourth order is found. But in any doctrine and discipline where the noble eightfold path is found, contemplatives of the first...second...third...fourth order are found. The noble eightfold path is found in this doctrine and discipline, and right here there are contemplatives of the first... second...third...fourth order. Other teachings are empty of knowledgeable contemplatives. And if the monks dwell rightly, this world will not be empty of Arahants.