The principle of least action is extremely robust and has been employed in so many interesting ways.
The Lagrangian for the electromagnetic field is given by:
$$\mathcal L=-{1\over 4}F_{\mu\nu}F^{\mu\nu}.$$
There are different conventions that use differing values for the constant out front, for example that which you see in J.D. Jackson's text, however, they all contain the "quadratic" form in $F_{\mu\nu}$.
Here, $F_{\mu\nu}$ and $F^{\mu\nu}$ are second order covariant and contravariant rank tensors known as the Faraday or field strength tensor, however, this is not so daunting as it may sound in this context because you can identify these quantities with matrices, albeit matrices that transform in the proper way under rotation. See Goldstein's Classical Mechanics chapter 13 for a good introduction to the Lagrangian formulation for continuous systems and fields, as that is precisely what the electromagnetic field is. At any rate, the Euler Lagrange equations for such systems has the form:$$\partial_\mu \bigg({\partial\mathcal L\over\partial (\partial_\mu \phi_\rho)}\bigg)-{\partial\mathcal L\over\partial\phi_\rho}=0.$$
$$\vdots$$
Where we have as many equations as we have fields. Notice that we have avoided differentiating with respect to the usual generalized coordinates and have instead differentiated with respect to some functions $\phi_\rho$. The functions $\phi_\rho$ are any set of functions which act as the "coordinates" of the Lagrangian, which in the continuous system is now a field or density that is defined everywhere in space, i.e. for a continuous system the lagrangian is such that:
$$\mathcal L=\mathcal L(\phi_{\rho}, \partial_\mu\phi_{\rho}, x^\mu).$$ The Lagrangian may be a function of any number of fields, their derivatives and possibly the raw coordinates themselves! You are right when you say that the subject is interesting!
Now back to Maxwell's theory. The field strength tensor is defined as:
$$F_{\mu\nu}=\partial_\mu A_\nu-\partial_\nu A_\mu,$$
and
$$F^{\mu\nu}=\partial^\mu A^\nu-\partial^\nu A^\mu.$$ So for the electromagnetic system, the field involved is the 4-vector potential $A^\mu$, so inserting these into the given Lagrangian expression we get:
$$\mathcal L=-{1\over 4}(\partial_\mu A_\nu-\partial_\nu A_\mu)(\partial^\mu A^\nu-\partial^\nu A^\mu).$$ So Maxwell's equations can be derived via the Euler Lagrange equations:
$$\partial_\nu\bigg({\partial\mathcal L\over\partial (\partial_\nu A^\mu)}\bigg)-{\partial\mathcal L\over\partial A^\mu}=0.$$
Now, this calculation is straightforward, however it does require that you get comfortable with manipulating indices, thus I will leave off the derivation for now and offer you some good pieces of advice that I hope you will pursue as your time admits.
Firstly, read 7.4-7.6 of Goldstein's Classical Mechanics, then read chapter 13 or at least 13.1-13.2, then you will be ready to calculate the above derivatives and find Maxwell's equations from the Lagrangian formulation. This is really not a lot of material to cover, and it serve as excellent preparation for more advanced physics.