1st EJB is not framework it is part of JEE standard, and its implementation is variant from application server to another, but all of them using same standard of EJB.
Spring and EJB is not the same thing, you can not make full comparison, but here are differences between both in the parts they are sharing: 1- EJB require EJB container to run in, but spring components are required only jars 2- Spring provide multiple projects like MVC for web development and WebFlow, Spring WS, Spring security and Spring Data, while EJB manly you are using for Entity, session, message Beans. 3- Spring have some feature was not existed before EJB3 but EJBs got a lot of them like DI and AOP with new EJB they are providing DI and can run outside of container check EJB CDI and interceptors.
1) Spring is light weight and doesn't need an app server to run whereas EJB is heavy compared to spring and requires an app server2) Spring is more versatile and provides integration points to lot of other frameworks. EJB also can be used with other frameworks, but doesn't have any direct integration support.3) EJB supports remote calls through RMI whereas there is no direct remote consumption mechanism for Spring. Spring beans can be probably exposed as remote through webservices.