Maybe.  You are protected against age discrimination if you are age 40 or older.  This means that your employer’s decision to lay you off cannot be motivated by your age.  But, your employer could legally lay you off and keep the younger employee if she had better skills than you.  The key is what factors the employer used to make the layoff decision.