JAKARTA, Indonesia—Allies of President-elect Joko Widodo are working to overturn a new law that ends direct regional elections in Indonesia, a battle that will require a Constitutional Court decision to succeed soon.

Lawmakers on Friday passed a law that ends the world's third-largest democracy's nine-year experiment with direct elections for mayors, governors and others. The law empowers elected regional councils to appoint these leaders instead. Indonesia's presidency will still be chosen in direct elections by voters every...