The porous fiber starts as a preform containing a hollow region that is filled with a solution. During drawing, temperature is maintained so that the solution remains fully liquid. After drawing, the fiber cools to below the phase-separation temperature of the solution. This causes the solution to separate into solid and liquid regions, creating liquid-filled pores along the fiber length. If desired, the liquid can be drained from the pores and optionally replaced with another material. The liquid-filled porous structure can serve as the electrolyte for a battery. Other battery components (such as the current collector, anode and cathode) can be included in the preform so the drawn fiber becomes a fully functional, flexible battery. Alternatively, the fiber can be configured for filtration or chemical synthesis.