This work describes the production of a novel biosurfactant produced by the bacterium Bacillus invictae UCP1617 cultivated using an alternative substrate and its use in the formulation of an eco‐friendly detergent. A factorial design was used to optimize agitation, temperature, and inoculum size in a mineral medium containing 1.5% corn steep liquor in 100‐mL shake flasks. The best conditions (175 rpm, 28°C, and 4% inoculum) were used to scale up biosurfactant production in a 50‐L bioreactor. Surface tension of the fermentation medium decreased from 69.5 to 30.2 mN/m within 72 h. The biosurfactant exhibited a critical micelle concentration (CMC) of 0.900 ± 0.08 g/L. The biosurfactant formed stable oil‐in‐water emulsions of motor oil and petroleum, achieving emulsification indices of 90.80% and 99.00%, respectively. An eco‐friendly detergent was formed that included biosurfactant at several different concentrations, 0.2 (wt) % hydroxyethyl cellulose and 0.2% potassium sorbate. The detergent remained stable under extreme conditions of pH, temperature, and salinity when stored for 90 days. The detergent was nontoxic to cabbage, cherry tomato plants, and the microcrustacean Artemia salina. A detergent formulation containing biosurfactant at the CMC completely dispersed motor oil in seawater at a 1:1 surfactant/oil (vol/vol) ratio and removed 99.21% of motor oil (20 mL) contained in 60 g of clayey soil. The detergent removed 98.42% of the oil adhered to a glass surface and removed 75.00% of motor oil adsorbed to a porous surface. The application of this biosurfactant as an environmentally friendly additive for remediation processes is feasible.