Operator noticed flames from engine compartment and attempted to extinguish with portable fire extinguisher. When it was empty, operator moved clear & initiated emergency response procedures. Local Fire Dept was able to extinguish fire. Fire was contained to engine compartment & likely caused from battery cable arcing to hydraulic hose at frame rail.